ImageGear for C and C++ on Linux v19.10 - Updated
DICOM
User Guide > File Formats and Compressions > File Formats > File Formats Reference > DICOM

Full Name DICOM (Digital Imaging & Communication in Medicine)
Format ID IG_FORMAT_DCM = 48
File Extension(s) *.dicm, *.dcm
Data Type Raster or vector image
Data Encoding Binary
Color Profile Support No
Multi-Page Support Yes
Alpha Channel Support No
ImageGear Platforms Support WIN32, WIN64, Unix (Linux), Mac, .NET, .NET64

To support the DICOM format, attach the ImageGear Medical Component to Core ImageGear. See Attaching Components.

ImageGear Supported Versions:

ImageGear Supported Features:

ImageGear Read Support:

ImageGear also supports reading of Adobe PDF documents, encapsulated in DICOM files. See Adobe PDF format description for information on supported Adobe PDF features.

ImageGear Write Support:

To be able to load encapsulated Adobe PDF documents, attach the ImageGear PDF Component. See Attaching Components.

ImageGear Filter Control Parameters:

Filter Control Parameter Type Default Value Available Values Description
DETECT_CONTINUOUS_RLE AT_BOOL TRUE TRUE, FALSE

This parameter specifies what to do with RLE compressed images where RLE runs across row boundaries. If it is set to TRUE, ImageGear tries to detect and load images where RLE runs across row boundaries. Otherwise, ImageGear truncates any row overruns and decodes each row separately. This parameter does not affect the loading of properly encoded images, where each row is encoded separately.

LOAD_APPLY_LUT_FOR_32G AT_BOOL TRUE TRUE, FALSE

Set to TRUE to apply LUT to pixel data for 17-32 bit grayscale images. Set to FALSE to leave pixel data intact.

By default ImageGear applies LUT to pixel data for 17-32 bit per pixel grayscale images. If it is not necessary, set this control parameter to FALSE.

LOAD_CONCAT_REPEATED_DE AT_BOOL FALSE TRUE, FALSE TRUE to concatenate repeated data elements into one data element during loading. Parameter LOAD_CONCAT_REPEATED_DE allows you to load incompliant DICOM images where some data elements are cut into several repeated data elements. Instead of one data element containing an array of values, the data set contains several data elements, with the same group/element numbers pair, containing portions of the array. Specifically, there are images with look-up tables and palettes stored in this way. Set LOAD_CONCAT_REPEATED_DE parameter to TRUE to concatenate repeated data elements into one data element during loading. Otherwise (default), ImageGear loads all of the repeated elements in the same way as they are located in the file. Note that ImageGear does not allow saving of repeated data elements. If a data set contains repeated data elements, ImageGear will only write first repeated element to the file.
LOAD_CONVERTTO8G AT_BOOL FALSE TRUE, FALSE

This control parameter has been deprecated and will be removed from the public API in a future release.

Use IG_image_channel_depths_change after image loading to change its channel depths. Convert 9-16 bit gray to 8 on load.

LOAD_DETECTSKIPDIMSE AT_BOOL FALSE TRUE, FALSE

This option controls loading process if a DICOM image contains DIMSE commands. DIMSE commands are a type of Data Element, with a group number of "0000" that are almost always removed by the DICOM network protocol before a transmitted image is saved to a disk file. However, sometimes they are found in the file and in such case ImageGear doesn't automatically recognize the file as a DICOM image. This is done because the DIMSE Tags are very hard to differentiate from other file formats that ImageGear supports. However, if DCM_CONTROL_LOAD_DETECT_SKIP_DIMSE is set to TRUE then the auto format detection skips over the DIMSE Tags when it attempts to decide if the file is DICOM or not.

LOAD_MASKALPHACHANNEL AT_BOOL TRUE TRUE, FALSE This option controls what would have done if an Alpha Channel image has been stuffed into the upper unused bits of a 16-bit image (Bits Stored < 16). These extra bits can be masked off or loaded along with the actual pixel value. If they are not masked off, you may need to alter the 16x8 LUT in order to display the image appropriately. If set to TRUE, the extra bits (the Alpha Channel) are masked off; if set to FALSE, the extra bits will be loaded into the DIB with the rest of the pixel.
LOAD_PAGENUMBER UINT 1 Any positive integer value

This control parameter has been deprecated and will be removed from the public API in a future release.

Use IG_fltr_load_file to load specific page of an image. Page number to load.

LOAD_SAVE_PIXDATA_TAG AT_BOOL FALSE TRUE, FALSE Set to TRUE to allow loading/saving pixel data to/from DataSet rather than to/from ImageGear DIB. When LOAD_SAVE_PIXDATA_TAG is TRUE, ImageGear does not read pixel data into a DIB, but rather creates an empty DIB, so the image cannot be displayed. When reading compressed image, ImageGear Medical treats PixelData tag as a Sequence, and places actual binary data into Item tags. This corresponds to the structure of compressed PixelData in DICOM files. When using this parameter for writing, make sure that Transfer Syntax matches actual Transfer Syntax of the PixelData element.
LOAD_SYNTAX INT MED_DCM_TS_AUTODETECT enumIGMedTS values

This parameter controls the types of DICOM files ImageGear attempts to detect. If the file that is being loaded does not fall into the category specified by this control parameter it will be ignored and a IGE_CANT_DETECT_FORMAT error will be returned.

  • MED_DCM_TS_AUTODETECT = 9998 - ImageGear makes its best to determine the format of the DICOM file.
  • MED_DCM_TS_PART_10 = 9997 - only files with Part 10 Header will be detected. The Transfer Syntax of the file will be determined from the header and used to load the remainder of the image file.

If you specify any standard DICOM Transfer Syntax, such as MED_DCM_TS_IMPLICIT_VR_LE or MED_DCM_TS_JPEG_LOSSY, the Medical Component will only load files having this Transfer Syntax.

LOAD_USE_8x8_LUT AT_BOOL TRUE TRUE, FALSE Set to TRUE to use 8x8 display LUT. Otherwise, use image's palette (the mechanism that was used in ImageGear v15.0 and earlier). Parameter LOAD_USE_8x8_LUT specifies the mechanism for display contrast adjustments of 8-bit grayscale images. Set to TRUE (default) to use 8x8 display LUT. Otherwise, use image's palette (the mechanism that was used in ImageGear v15.0 and earlier).
LOAD_USE_AUTO_WL_FOR_8G AT_BOOL TRUE TRUE, FALSE Set to TRUE to use auto window/level for 8g images, if VOI LUT is not present. Parameter LOAD_USE_AUTO_WL_FOR_8G affects loading of 8-bit grayscale images that do not have a VOI LUT (either a LUT sequence or window center/width values). Set to TRUE to use auto window/level for these images. Set to FALSE to apply no window/levelling (set contrast range to 0...255).
SAVE_ASPART10 AT_BOOL TRUE TRUE, FALSE This parameter controls whether Meta Information Header is saved with the file or not. TRUE will cause the Header to be saved.
SAVE_GROUPLENGTHS AT_BOOL TRUE TRUE, FALSE

This parameter controls the usage of Group Length values in a DICOM file. ImageGear treats these Data Elements as either on or off. That is they either are all included in each Group of Data Elements through the saving process or they are all absent. The internal Data Set that is attached to the HIGEAR does not contain Group Length Data Elements. When a DICOM file is to be written to disk they are computed and inserted if this parameter is set to TRUE. A value of TRUE indicates that Group Length values will be saved; FALSE indicates that they will not be saved.

SAVE_JPGQUALITY UINT 70 1 - 100

This control parameter has been deprecated and will be removed from the public API in a future release. Please use QUALITY control parameter of JPEG filter instead.

JPEG Quality setting 1-100

SAVE_LARGEST AT_BOOL FALSE TRUE, FALSE

Controls whether Largest Image Pixel Value (0028,0107) is updated by ImageGear.

If the original image Data Set did not contain a Data Element for Largest Image Pixel Value (0028,0107) and you set SAVE_LARGEST = TRUE, ImageGear scans the image and determines a value for this DE. Largest Image Pixel Value is included in the Data Set of the DICOM image being saved and contains the ImageGear-determined value. The value of the DE from the original Data Set (if any) is ignored.

If you set SAVE_LARGEST = FALSE, ImageGear does not determine this value for you, and the Data Set of the image being saved does not include the Largest Image Pixel Value Data Element. However, if the original Data Set did contain this DE, ImageGear preserves and includes it in the Data Set being saved

SAVE_PLANARCONFIG INT MED_DCM_PLANAR_PIXEL_BY_PIXEL
  • MED_DCM_PLANAR_PIXEL_BY_PIXEL
  • MED_DCM_PLANAR_PLANE_BY_PLANE

This parameter controls how the pixels are saved:

  • MED_DCM_PLANAR_PIXEL_BY_PIXEL: in normal RGB order ("pixel by pixel" configuration).
  • MED_DCM_PLANAR_PLANE_BY_PLANE: in a planar configuration, meaning that all Red, Blue, and Green pixels are saved in separate planes.
SAVE_SMALLEST AT_BOOL FALSE TRUE, FALSE

This parameter controls whether ImageGear updates the Smallest Image Pixel Value (0028,0106).

If the original image Data Set did not contain a Data Element for Smallest Image Pixel Value (0028,0106) and you set SAVE_SMALLEST = TRUE ImageGear scans the image and determines a value for this DE. Smallest Image Pixel Value are included in the Data Set of the DICOM image being saved, and contains the ImageGear-determined value. The value of the DE from the original Data Set (if any) are ignored.

If you set SAVE_SMALLEST = FALSE ImageGear does not determine this value for you, and the Data Set of the image being saved does not include the Smallest Image Pixel Value Data Element. However, if the original Data Set did contain this DE, ImageGear preserves and includes it in the Data Set being saved.

SAVE_SYNTAX INT MED_DCM_TS_DEFAULT enumIGMedTS values This parameter controls how a DICOM file is to be formatted when it is written to disk. It does not control the file being Part 10 or Raw (see bSaveAsPart10), but controls how the non-Group 2 Data Elements are formatted. It also specifies the compression that will be used for Pixel Data.

 

Comments:

DICOM is a public standard created to provide a flexible and expandable means for storing, sharing, and transporting digital medical images. Today DICOM is the standard for medical imaging throughout the world.

DICOM image (alternately called Data Set) contains an ordered collection of attributes referred to as "Data Elements" that are related to one or more images. Each Data Element (DE) describes a single attribute of the image, patient, or study. The images themselves are also stored in DEs.

Each DICOM Data Set is transported through the Network, and consequently, stored in a file, using one of the defined Transfer Syntaxes. The Transfer Syntax of the DICOM file indicates whether the file uses Big Endian or Little Endian byte order, whether the image data is compressed or uncompressed, and if the DICOM Data Set uses Explicit or Implicit Value Representation (VR).

The Data Element (DE) is made up of the following parts:

Tag field identifies the type of information that is contained in the Value field (where the actual data is stored). The DICOM Data Dictionary (Part 6 of the specification) defines all possible public Data Element Tags that may be used. DICOM also allows applications to define and use private Tags and thus define their own Data Elements. Value Representation (VR) specifies the format of the Data Element Value, such as UL (unsigned long), ST (Short Text) or PN (Person Name). If Implicit Transfer Syntax is used, the VR field is omitted. It can be obtained from the standard or private Data Dictionary. Value Length is the length (in bytes) of the Data field.

DICOM also allows embedding (nesting) Data Sets within Data Sets. Nested Data Sets are implemented using a "Sequence of Items" (SQ), which is a special type of Data Element.

A special group of tags at the beginning of the file allows application to recognize the file as a DICOM image file, and includes information needed to decode the file (Transfer Syntax), and serial numbers to help locate and keep track of each field. This header is referred to as "File Meta Information Header", or "Part 10 Header" (since it is defined in Part 10 of the DICOM standard). While the standard clearly states that all DICOM image files must include a Part 10 Header, in reality one finds that many do not. Instead, the average DICOM image file is a simple data stream capture of the data into a file. This is called a "Raw Data" DICOM image file. In order to read a Raw DICOM the Transfer Syntax must be guessed at using a Transfer Syntax detection algorithm.

The actual pixel data for a DICOM image is stored in a Data Element, just like any other DICOM information. Image parameters, such as dimensions, bit depth, photometric interpretation etc., are also stored in Data Elements. The Tag for Pixel Data is called "Pixel Data" and has the Tag Number 7FE0, 0010. The Data Field in this Data Element contains all pixels for the image. Depending on the image's Transfer Syntax, the Pixel Data can be compressed or uncompressed.

References Used

Digital Imaging and Communication in Medicine (DICOM). Published by: National Electrical Manufacturers Association: https://www.dicomstandard.org/.