[Post] medical digital imaging and Communication (DICOM) programming Overview

Source: Internet
Author: User

There are too few materials available on the Internet when I first started to contact DICOM.
I would like to share some of my experiences and experiences with you. I hope that the netizens who made DICOM in the Forum will be able to get some inspiration.
Directory:
1. What is DICOM?
Binary DICOM file structure
3. How to Write DICOM programs
4. Develop DICOM program using the Development Kit
5. DCMTK usage
1. What is DICOM?
The full name of DICOM is medical digital imaging and communication. It is an encoding and data transmission protocol. The X-ray film produced by the CTF in the Hospital complies with this Protocol. Of course, this is also true for other instruments, such as MRI. The films we usually see are only part of the printed DICOM files. All operations on the CTM, including printing, file generation, and transmission, must comply with the DICOM protocol.
DICOM official website in http://medical.nema.org here. You can download the DICOM English protocol here.
China PACS Forum http://www.cnpacs.org here has a special discussion of DICOM section contains a lot of information, which has a user translation of DICOM Chinese protocol. (Most of the materials in this article are from this forum)
Binary DICOM file structure
Is the structure of DICOM files.
The software used in the figure is "jdicom", which is a free software written in Java. This software is an indispensable reference for DICOM development. Its URL is a http://www.tiani.com entry site with a "jdicom" item in the menu research. The Java software license downloads a j2re-1_3_000014-windows-i586-i.exe "web site here http://java.sun.com/products/archive/index.html Of course" www.tiani.com "will also have related connections.


The following is a post that references the main account JB on the PACS forum.
To briefly introduce the DICOM file structure. I believe that with the above software "jdicom", we can directly observe DICOM and add the post on this PACs to read the DICOM protocol. I believe that we will have a clear understanding of the structure of DICOM files.
The following is the post content:
DICOM file format
The DICOM file content is defined in Part 3 dicom iod. CT, Mr, Cr, Dr, US, nm, pet, XA and so on have their own content definitions, composed of a common proprietary part (ie and modules.
The DICOM file consists of two parts: the header of the parameter and the pixel data ).
The header only describes the basic parameters of the image, such as basic patient data, basic test data, series data, and location data.
Four levels of DICOM content:
1. Patient (patient)
2. Study (test)
3. Series)
4. Image)
Although the content of the first few layers is the same in many images, they must be included in each image file.
Each layer is called an Information Entity or IE (referenced from the relational database schema design ). Each layer is subdivided into modules. The smallest unit in each module is an attribute or element.
For example: CR image (DICOM part 3, a.2.3, table A.2-1
1. Patient ie:
A. Patient module (refer to c.7.1.1)
2. Study ie:
A. Study Module (refer to c.7.2.1)
B. Patient Study Module (refer to c.7.2.2)
3. Series ie:
A. General series (see c.7.3.1)
B. Cr series (see c.8.1. 1)
C. General equipment (see c.7.5.1)
4. Image ie:
A. genrral image (c.7.6.1)
B. image pixel (c.7.6.3)
C. Contrast/bolus (c.7.6.4)
D. CR image (c.8.1.2)
...
I. SOP common (C.12.1)
Find all elements in these modules (tables) and create a CR image architecture.
Note that some of these modules are mandatory (modatory) and some are selected by users ).
In each module, the attribute/element table contains five types: Type 1, 1C, 2, 2c, and 3. Type 1 is required, and 2 is required, but the content can be empty. Type 3 is optional.
Therefore, there are not many elements in a CR image.
After the tables are expanded, these elements form a dataset.
What is the format for writing to a file or transmitting it over the network? This depends on Part 5.
The structure of an element is:
1. Group Tag: 16-bit
2. Element Tag: 16-bit
3. Length (or VR/length): 32-bit
4. Data (bytes of length)
Each element DICOM Standard Part 6 that is used defines a group tag and an element tag. For example:
Patient Name: 0x0010, 0x0010
Patient ID: 0x0010, 0x0020
...
VR refers to the element format. For example, the VR of patinet name Is PN. The format is last_name ^ first_name ^ middle_name ^ prefix ^ surfix. My English name is: Wang ^ JB ^ dr. ^

When writing data out, you need to do the following:
1. Sort all elements by group tage and element tag (SORT ). From small to large.
2. If the DICOM file is written into DICOM media, first write 128 bytes preamble (usually blank), add "dicm", and add group 2 meta header. (Let's Talk About Part 10)
3. If the dataset contains sequence elements, each item in the sequence is a dataset.
[Note]: There are 15 chapters in DICOM protocol, of which Chapter 3 is "definition of information objects" and Chapter 5 is "data structure and encoding ", chapter 6 is the "Data Dictionary.
IMG: http://www.vchelp.net/ASP/cdf_pic/200410/reply_1_746525.jpg
3. How to Write DICOM programs
It is very difficult to write DICOM files by yourself. The compiled programs often have compatibility issues.
I advocate developing DICOM programs with sdks. However, to better understand the DICOM protocol, I should try to take a look at other people's code at least.
Two programs are provided here. Both programs have compatibility issues, and some DICOM files cannot be read. However, it is worth reading as a reference for beginners.
The first program is written by JB, the main moderator on the PACS Forum (right! In other words, mongodcmbmp Conversion Program .rar is mainly used to convert pixel information in DICOM files into BMP files.
The second program was written by wakyrei, a netizen on the PACS Forum (all the information on the PACS forum has been lost due to the destruction of the server database file ), "DCM" this program is quite dry and requires patience to read it. The author does not seem to understand how to use MFC, but the DICOM class is worth pondering.
File: http://www.vchelp.net/ASP/cdf_pic/200410/reply_1_746526.rar
4. Develop DICOM program using the Development Kit
There are many tool kits for developing DICOM. Here we will talk about DCMTK, which is free of charge for all development source code.
The official website of DCMTK is http://www.dcmtk.org. Click DCMTK in DICOM software on the left to download DCMTK. There are many links here. You only need to download two items:
1. DCMTK 3.5.3-source code and documentation (2004-05-27)
2. DCMTK 3.5.3-support libraries for Windows
Do not uncompress the files. Another software is required to generate engineering files. This software is called cmake. The official website is this http://www.cmake.org many medical related Development Kits like VTK/Itk all need this software to generate engineering files.
That is, how cmake opens the DCMTK development kit.
Several with _ * options are extracted from "2. DCMTK 3.5.3-support libraries for Windows. After clicking configure twice, you can click OK to generate the project file.
After the project file is compiled, the program will generate many example programs for reference. For example, run the program dcmdata \ apps \ debug \ d1_ump.exe. This is a program for parsing DICOM files. You can refer to this program to develop DICOM files.
Pay attention to the following issues when calling the database:
1. Set/CC ++/Preprocessor/to append the inclusion path. Set the header file here
2. Project Settings/link/input/Object Library module. Set the library file here.
3. Project Settings/link/project option /. Set the library file path here.
4. Project Settings/CC ++/code generation/use run-time library.
5. the above items must be consistent with the settings in the example program.
IMG: http://www.vchelp.net/ASP/cdf_pic/200410/reply_1_746527.jpg
5. DCMTK usage
Because DCMTK is not used in zookeeper FC. Therefore, you need to generate the database before calling it.
Two programs are provided here.
1. static libraries generated using DCMTK.
2. Call the static library to generate a program to read DICOM directory files.
The whole program is made by referring to dcmtk's example dw.ump.exe.
Http://www.vchelp.net/ASP/cdf_pic/200410/reply_1_747225.rar

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.