DICOM command set and dataset ParsingWang Xiaonan
Abstract:By analyzing a typical DICOM message, this article analyzes in detail the composition and meaning of the DICOM command set and dataset. On this basis, an Implementation Scheme for implementing DICOM command set and dataset Parsing is proposed, and the design ideas and specific implementation methods of this scheme are described in detail.
Keywords:Medical digital imaging and communication standards, information object definitions, service object Pairs
1.
PrefaceDICOM (Digital Imaging and communications in medicine) is an international standard communication protocol for medical devices, it defines a unified specification for various command operations on digital information such as medical images between different medical devices. More and more medical equipment manufacturers are now implementing and supporting DICOM standards. The widely used version is dicom3.0. In this article, we use an example to analyze how the DICOM protocol uses the DICOM command set and dataset to store images between different medical devices, an Implementation Scheme for parsing DICOM command sets and datasets is proposed.
2.
Information object definitionDICOM is a network communication interface standard for digital medical images. Based on this, it is an important step to abstract objects in the real world into data to develop standards. The DICOM Standard describes many information object classes (IOC ). These information objects provide an object-oriented abstract definition for objects that can communicate in the real world using digital medical images. This definition is called information object definition, IOD ). An information object definition (IOD) is composed of several information entities that contain relevant information. Each information entity corresponds to a data abstraction of real-world entities (such as patients and images) in DICOM application models. Each information entity is composed of several attributes, which are the abstraction of the real-world entity nature (such as the patient's name, age, image imaging date, etc. In DICOM standard, each attribute is described by a data element, and a set of related attributes of an Information Entity is described by a dataset.
3.
Service object pairThe object-oriented design not only describes the attributes of objects, but also describes how to process these objects. DICOM standards use this concept to define services such as storing images and acquiring patient information. Because it is an object-oriented design, services are also called service classes. A service class consists of several related service object classes (SOP class. The SOP class is the basic function unit defined in the DICOM standard. For a specific SOP class, a device may assume the following two roles: 1. Service class provider (SCP), the machine playing this role provides SOP services, it is equivalent to a server in the customer/server model. 2. A service class user (SCU) is used by devices playing this role to use SOP services, it is equivalent to a customer in the customer/server model. For example, an imaging device needs to print an image. In this case, the imaging device is a SCU of the SOP type associated with printing, and the printer is SCP. A specific implementation of an SOP class is called an instance of a service object. operations such as image storage and patient information retrieval are implemented through an SOP instance. Figure 1 vividly describes the relationship between the SOP class and its instances.
Verb: Store service (DIMSE)
Term: MRI image object definition IOD
General sentence: store a MRI image Sop
Store this MRI image SOP instance
Figure 1 SOP and Instances
4.
DICOM
MessageA sop class is defined as a combination of a specific set of services and a related information object (IOD). The specific implementation of an SOP class is completed through the interaction of DICOM messages. In DICOM standard, DICOM messages are composed of command sets and datasets. datasets describe an instance of information objects in the real world, while command sets describe what operations are performed on this information object instance. A command set consists of several command elements. Each command element consists of a tag field, a value length field, and a value field. A dataset consists of several data elements. Each data element consists of a tag field, a data representation type field (optional field), a value length field, and a value field. Whether in a command set or data set, tags uniquely identify a command or data element. elements must be sorted in ascending order of tags, generally, each element can only appear once (except for nesting). An element tag consists of a group number and an element number, both of which are 16 unsigned integers; the value length field indicates the length of the value field based on the number of bytes, and the value must be an even number. The value field contains the attribute values of related operation commands (for command elements) or the actual world information object instance attribute value (for data elements), its length is variable, but cannot exceed the length specified by the value length field. In a dataset, data indicates that the type field is an option, indicating the type of the Value Field. When an element contains this field, it is called explicit VR (value representation); otherwise it is called implicit VR. The following table describes a typical DICOM message, where the dataset describes an image instance, and the meaning of the command set is to request a storage (C-STORE) Service to the image instance, apparently, this is a request message from the SCU to the SCP storage (C-STORE) request. The element with group number 0000 is the command element, and the other is the data element. See table 1. Table 1 DICOM request message of the C-Store service
Group |
Element |
Length |
Value |
Meaning |
Description |
0000 |
0000 |
0004 0000 |
0056 0000 |
|
An even number of bytes starting from the end of this field to the next group |
0000 |
0001 |
0004 0000 |
01a0 0010 |
|
An even number of bytes from the end of this field to the end of the message |
0000 |
0010 |
000c 0000 |
4341 2d52 454e 414d 3120 302e |
"ACR-NEMA 1.0" |
Identifier |
0000 |
0100 |
0002 0000 |
0001 |
0001 H |
Command Field = C-store-Request |
0000 |
0110 |
0002 0000 |
123a |
123a |
Message Identification number generated by the imaging device |
0000 |
0200 |
0004 0000 |
4344 3148 |
"Dashboard" |
Sender's Logical Address |
0000 |
0300 |
0004 0000 |
4341 3148 |
"Ach1" |
Recipient's Logical Address |
0000 |
0800 |
0002 0000 |
0000 |
0000 h |
Data Type = image |
0008 |
0000 |
0004 0000 |
0080 0000 |
|
|
0008 |
0001 |
0004 0000 |
013e 0100 |
|
|
0008 |
0010 |
000c 0000 |
4341 2d52 454e 414d 3120 302e |
"ACR-NEMA 1.0" |
Identifier |
0008 |
0020 |
000a 0000 |
3032 3230 312e 2e31 3532 |
"2002.11.25" |
Item check date |
0008 |
0030 |
0008 0000 |
3231 303a 3a35 |
12:05:59" |
Item check time |
0008 |
0040 |
0002 0000 |
0000 |
0000 h |
Dataset type = image |
0008 |
0060 |
0002 0000 |
5254 |
"Dr" |
Imaging Mode |
0008 |
0070 |
0004 0000 |
4241 4443 |
"ABCD" |
Manufacturer |
0008 |
0080 |
000e 0000 |
454d 4352 2059 4f48 5053 5449 4c41 |
"Mercy Hospital" |
Hospital identification number |
0008 |
0090 |
0000 0000 |
|
|
Physician unknown |
0010 |
0000 |
0004 0000 |
0042 0000 |
|
Group Length |
0010 |
0010 |
000e 0000 |
4f4a 454e 2c53 4a20 4d49 4320 202e |
"Jones, Jim C." |
Patient Name |
0010 |
0020 |
0008 0000 |
3031 2d32 3033 2034 |
"102-304" |
Patient Identification Number |
0010 |
0030 |
000a 0000 |
3931 3632 312e 2e31 3532 |
"1926.11.25" |
Patient Date of birth |
0010 |
0040 |
0002 0000 |
204d |
"M" |
Patient gender = male |
0018 |
0000 |
0004 0000 |
0000 0000 |
|
The Group length is zero-no other elements are transferred |
0020 |
0000 |
0004 0000 |
0018 0000 |
|
Group Length |
0020 |
0010 |
0004 0000 |
3932 3330 |
2903" |
Check item No. |
0020 |
0020 |
0004 0000 |
5c52 2046 |
"R/F" |
Patient Orientation |
0028 |
0000 |
0004 0000 |
002c 0000 |
|
Group Length |
0028 |
0010 |
0002 0000 |
0400 |
0400 H |
Number of rows = 1024 |
0028 |
0011 |
0002 0000 |
0400 |
0400 H |
Number of columns = 1024 |
0028 |
0030 |
0006 0000 |
2e20 5c33 332e |
". 3 \. 3" |
Actual pixel size = 0.3*0.3 pixels |
0028 |
0100 |
0002 0000 |
0008 |
008 H |
The number of digits specified for each pixel = 8 |
7fe0 |
0000 |
0004 0010 |
0008 0010 |
|
Group Length |
7fe0 |
0010 |
0000 0000 |
*******... ***** |
|
Pixel data (524,288 bytes) |
5.
EncodingIn practical application, two base classes celement and celementset are used to represent the data elements (or command elements) and the abstraction of these element sets, and their basic feature attributes are described. The two basic classes can be used to derive other classes. For example, we use a derived class dcmfile of celementset to describe a DICOM image file. In this class, we implement two main methods: loaddcmfile () and writetodcmfile (), they mean reading DICOM image files from the specified path and restoring all data elements in the dataset to DICOM image files in the specified path. Similarly, we use another derived class commandset of celementset to describe a command set. It contains two main methods: getcmdvalue () and getdatatype (), the meaning is to obtain the service and message types described in this command set and the Information Entity types described in the operation object (Dataset) for this command set. When parsing a command set (or a dataset, such as a DICOM image file), you can use tags to read the command elements (or data elements) that interest you ), the command element (Data Element) is processed as an instance of the class ccommandelement (or cdataelement, which is a derived class of the class celement. For example, when parsing DICOM messages in Table 1, you should first read its command set, that is, elements with a group number of 0000. Each command element to be read exists as an instance of the class ccommandelement (derived class of the class celement), and the set of all command elements to be read exists as an instance of the class commandset. Then, use the methods getcmdvalue () and getdatatype () provided by commandset to obtain the service and message types described in this command set and the operation objects (I .e. datasets) of this command set) information Entity type. In this example, according to DICOM standards, because the value of the value range labeled [0001] in the command set is H, the command set describes the C-STORE service request, the specific value of the value range labeled [0000] is H. Therefore, the type of the operation object (that is, the dataset) of this command set is image. In combination, this DICOM message means that the image files stored in the dataset are encapsulated. After parsing the command set, read the dataset in the same DICOM message based on the parsing result. That is, the group number is not an element of 0000. Here, each read data element is used as an instance of the class cdataelement (derived class of the class celement), and the set of read data elements is used as an instance of the class dcmfile. Then, call the writetodcmfile () method provided by dcmfile to restore these data elements to an image file and store them. Finally, a response is constructed based on the command execution success and failure and returned to the service requester.
6
. ConclusionDICOM is the first widely accepted international standard for communication between medical devices. It plays a very important role as a link between computer and medicine. By analyzing a typical DICOM message, this article analyzes in detail the composition and meaning of the DICOM command set and dataset. On this basis, an Implementation Scheme for implementing DICOM command set and dataset Parsing is proposed, and the design ideas and specific implementation methods of this scheme are described in detail. The implementation of DICOM command set and dataset parsing provides the basis for remote medical applications.
References1. national Electrical Manufacturer Association. digital Imaging and communication in medicine (DICOM) [s], 19992. jia Kebin, Shen Bo. key Technologies for implementing medical image archiving and transmission systems [J]. journal of image graphics, 539 (a) (7): 544-