JDCM Java DICOM Toolkit: User's Guide
JDCM Java DICOM Toolkit: User's Guide
User’s Guide
JDCM User’s Guide
Overview
This user’s guide is targeted toward the developer of
medical imaging applications using the JDCM Tool Kit to
supply DICOM network or media functionality. JDCM
supplies you with a powerful and simplified interface to
DICOM. It lets you focus on the important details of your
application, rather than the often complex and confusing
details of the DICOM Standard.
1
JDCM User’s Guide
DICOM Associations
A_Abort
A_Associate
A_Release
DCMServer
Library import
In order to access the classes of the JDCM class library you
should import the jdcm.jar package in your applications.
import jdcm.*;
2
JDCM User’s Guide
Association Management
You will probably want to initiate an association if you are
a client, or wait for an association if you are a server.
Clients will use the Constructors of A_Associate class and
servers will inherit the DCMServer class. Before you
establish an association connection you must determine
what DICOM services you are prepared to handle and
perhaps create a list of proposed context to encapsulate
the service information.
A proposed context object represents:
One DICOM service (SOP class).
A set of transfer syntaxes you can support for the
service.
Presentation Context ID assigned to context's
service.
Association sample 1
In this example the application entity title of the DICOM
application with which we want to connect is ANY-SCP and
our own application entity title is JDCM. Propose a SOP
Class with Implicit Little Endian syntax transfer.
A_Associate associate;
3
JDCM User’s Guide
try {
associate = new A_Associate(
socket,"JDCM",
"ANY-SCP",
"1.2.840.10008.5.1.4.1.1.6.1", //affected SOPClass
"1.2.840.10008.1.2"); //transfert Syntax
.. .
} catch(IOException e) {...}
Message Exchange
DICOM messages are exchanged with other application
entities over the network. The exchange of DICOM
messages between applications only occurs over an open
association. After the DICOM client (SCU) application
opens an association with a DICOM server (SCP), the client
sends request messages to the server application. For each
request message, the client receives back a corresponding
response from the server. The server waits for a request
message, performs the desired service, and sends back
some form of status to the client in a response message.
4
JDCM User’s Guide
do{
dicomSet = find.readRPS();
//retrieve the status of the response message
status = find.getStatus();
} while(status != 0);
associate.close();
socket.close();
5
JDCM User’s Guide
while(true) {
socket = serverSocket.accept();
appSCP = new AppSCP(socket);
appSCP.start();
}
} catch(Exception e){...}
}
}
6
JDCM User’s Guide
7
JDCM User’s Guide
Association Properties
The A_Associate class contains several methods that can
be used to retrieve properties of the association.
8
JDCM User’s Guide
DimseMessage Properties
The DimseService class contains several methods that can
be used to retrieve or set properties of the DIMSE
message: C-FIND, C-MOVE, C-STORE, C-ECHO, N-ACTION,
N-CREATE, N-DELETE, N-EVENT-REPORT, N-SET, N-GET
9
JDCM User’s Guide
MessageID
The DIMSE service provider (ex JDCM) assigns a number
to each DIMSE request message. The getMessageID()
method retrieves that identifying number from the
command set attribute (0000,0110).
Status
The setStatus() and getStatus() methods set and
retrieves the response status code (0000,0900) from the
message command response set.
Priority
The getPriority() method retrieves the priority number
from the command request set attribute (0000,0700).
Presentation context ID
The getPresentationContextID() method retrieves the
DICOM Presentation Context ID assigned to this context's
service for the current association.
Manipulation of attributes
The different attributes of DICOM data elements are
internally stored in the DicomElement class. The
DicomElement class contains a (group, element) pair and
10
JDCM User’s Guide
int
DicomElement(int group, int element,String vr, int value)
DicomElement(int group, int element,String vr, int[] value)
getValueAsInt(int index)
getValueAsInt()
double
DicomElement(int group, int element,String vr, int double)
DicomElement(int group, int element,String vr, int[] double)
getValueAsDouble(int index)
getValueAsDouble()
String
DicomElement(int group, int element,String vr,String value)
DicomElement(int group, int element,String vr,String[] value)
getValueAsString(int index)
getValueAsString()
byte[]
DicomElement(int group, int element, String vr, byte[] value)
getValue()
Sequence
DicomElement(int group, int element,String vr, DicomSequence sequence)
getSequence()
11
JDCM User’s Guide
Sequences of Items
The DICOM Value Representation SQ is used to indicate a
DICOM attribute that contains a value that is a sequence of
items. Each item in the sequence is a data set. Each of the
data sets can also contain attributes that have a VR of SQ.
12
JDCM User’s Guide
try {
DicomFile dicomFile = new DicomFile("C:/dcmFile.dcm");
...
} catch(IOException e){...}
try{
File file = …
DicomFile dicomFile = new DicomFile(file)
} catch(IOException e){ }
13
JDCM User’s Guide
try{
//Constructing a DicomFile Instance
DicomFile dicomFile = new DicomFile("C:/dicomFile.dcm");
//Get the file meta info attribute set
DicomGroup dicomGroup = dicomFile.getMetaFile();
DicomElement dicomElement;
for (Iterator i = dicomSet.getDicomElements(); e.hasNext ();) {
dicomElement = (DicomElement)e.next ();
System.out.println(dicomElement);
}
14
JDCM User’s Guide
try {
DicomSet ds = new DicomSet();
ds.setElement(new DicomElement(0x0008,0x0008,"UI",
new String[] {"DERIVED","SECONDARY"}));
ds.setElement(new DicomElement(0x0008,0x0016,"UI",
"1.2.840.10008.5.1.4.1.1.7"));
ds.setElement(new DicomElement(0x7fe0,0x0010,"OB",raw));
} catch(IOException e){}
Dictionary
JDCM package load DICOM data dictionary from
jdcm/dictionary.properties in jdcm.jar file. You can extend
the default dictionary with your private dictionary using.
StaticProperties.setPrivateDictionary("private.dic");
0019,0013=CRImageIPParamsRight,ST,1
0029,0050=SceneText,LT,1
00E1,0040=OffsetFromCTMRImages,SH,1
0019,002f=TriggerFrequency,DS,1
StaticProperties.setPresContext(“presContext.txt”)
15
JDCM User’s Guide
Library Constants
Setting/getting properties in StaticProperties class.
Conformance statement
Since JDCM class library is not an application, this
conformance statement only gives an outline of the of the
DICOM services it supports:
AE specifications
JDCM provides support for applications, which deal with
the following Service Object Pairs (SOPs):
1.2.840.10008.5.1.1.27 StoredPrintStorage
1.2.840.10008.5.1.1.29 HardcopyGrayscaleImageStorage
1.2.840.10008.5.1.1.30 HardcopyColorImageStorage
1.2.840.10008.5.1.4.1.1.1 ComputedRadiographyImageStorage
1.2.840.10008.5.1.4.1.1.1.1 DigitalXRayImageStorageForPresentation
1.2.840.10008.5.1.4.1.1.1.1.1 DigitalXRayImageStorageForProcessing
1.2.840.10008.5.1.4.1.1.1.2 DigitalMammographyXRayImageStorage
ForPresentation
1.2.840.10008.5.1.4.1.1.1.2.1 DigitalMammographyXRayImageStorage
ForProcessing
1.2.840.10008.5.1.4.1.1.1.3 DigitalIntraOralXRayImageStorage
ForPresentation
1.2.840.10008.5.1.4.1.1.1.3.1 DigitalIntraOralXRayImageStorage
ForProcessing
16
JDCM User’s Guide
1.2.840.10008.5.1.4.1.1.2 CTImageStorage
1.2.840.10008.5.1.4.1.1.3.1 UltrasoundMultiframeImageStorage
1.2.840.10008.5.1.4.1.1.4 MRImageStorage
1.2.840.10008.5.1.4.1.1.4.1 EnhancedMRImageStorage
1.2.840.10008.5.1.4.1.1.4.2 MRSpectroscopyStorage
1.2.840.10008.5.1.4.1.1.6.1 UltrasoundImageStorage
1.2.840.10008.5.1.4.1.1.7 SecondaryCaptureImageStorage
1.2.840.10008.5.1.4.1.1.7.1 MultiframeSingleBitSecondaryCapture
ImageStorage
1.2.840.10008.5.1.4.1.1.7.2 MultiframeGrayscaleByteSecondaryCapture
ImageStorage
1.2.840.10008.5.1.4.1.1.7.3 MultiframeGrayscaleWordSecondaryCapture
ImageStorage
1.2.840.10008.5.1.4.1.1.7.4 MultiframeTrueColorSecondaryCapture
ImageStorage
1.2.840.10008.5.1.4.1.1.8 StandaloneOverlayStorage
1.2.840.10008.5.1.4.1.1.9 StandaloneCurveStorage
1.2.840.10008.5.1.4.1.1.9.1.1 TwelveLeadECGWaveformStorage
1.2.840.10008.5.1.4.1.1.9.1.2 GeneralECGWaveformStorage
1.2.840.10008.5.1.4.1.1.9.1.3 AmbulatoryECGWaveformStorage
1.2.840.10008.5.1.4.1.1.9.2.1 HemodynamicWaveformStorage
1.2.840.10008.5.1.4.1.1.9.3.1 CardiacElectrophysiologyWaveformStorage
1.2.840.10008.5.1.4.1.1.9.4.1 BasicVoiceAudioWaveformStorage
1.2.840.10008.5.1.4.1.1.10 StandaloneModalityLUTStorage
1.2.840.10008.5.1.4.1.1.11 StandaloneVOILUTStorage
1.2.840.10008.5.1.4.1.1.11.1 GrayscaleSoftcopyPresentation
StateStorage
1.2.840.10008.5.1.4.1.1.12.1 XRayAngiographicImageStorage
1.2.840.10008.5.1.4.1.1.12.2 XRayFluoroscopyImageStorage
1.2.840.10008.5.1.4.1.1.20 NuclearMedicineImageStorage
1.2.840.10008.5.1.4.1.1.66 RawDataStorage
1.2.840.10008.5.1.4.1.1.77.1.1 VLEndoscopicImageStorage
1.2.840.10008.5.1.4.1.1.77.1.2 VLMicroscopicImageStorage
1.2.840.10008.5.1.4.1.1.77.1.3 VLSlideCoordinatesMicroscopic
ImageStorage
1.2.840.10008.5.1.4.1.1.77.1.4 VLPhotographicImageStorage
1.2.840.10008.5.1.4.1.1.88.11 BasicTextSR
1.2.840.10008.5.1.4.1.1.88.22 EnhancedSR
1.2.840.10008.5.1.4.1.1.88.33 ComprehensiveSR
1.2.840.10008.5.1.4.1.1.88.50 MammographyCADSR
1.2.840.10008.5.1.4.1.1.88.59 KeyObjectSelectionDocument
1.2.840.10008.5.1.4.1.1.128 PETImageStorage
1.2.840.10008.5.1.4.1.1.129 PETCurveStorage
1.2.840.10008.5.1.4.1.1.481.1 RTImageStorage
1.2.840.10008.5.1.4.1.1.481.2 RTDoseStorage
1.2.840.10008.5.1.4.1.1.481.3 RTStructureSetStorage
1.2.840.10008.5.1.4.1.1.481.4 RTBeamsTreatmentRecordStorage
1.2.840.10008.5.1.4.1.1.481.5 RTPlanStorage
1.2.840.10008.5.1.4.1.1.481.6 RTBrachyTreatmentRecordStorage
1.2.840.10008.5.1.4.1.1.481.7 RTTreatmentSummaryRecordStorage
17
JDCM User’s Guide
18
JDCM User’s Guide
19