INTERNAL/REVIEW: IDLffDicomEx: JPEG/JPEG 2000 File Compression and Transfer Syntax Support
Help Article Update 2
Anonym
[Needs to be reviewed for Compliance and IP issues (i.e. .pro file included)]
Topic:
The IDLffDicomEx object supports reading and writing to compressed files on Windows and UNIX platforms. There is no support for the JPEG compression algorithms on Macintosh. Using IDLffDicomEx properties and methods, you can return and modify the compression of a file.
Discussion:
Use the TRANSFER_SYNTAX property to return the Transfer Syntax UID (0002,0010) associated with the DICOM file. Use the IDLffDicomEx::ChangeTransferSyntax method to change the transfer syntax of an object. The IDLffDicomEx object supports the following JPEG compression transfer syntaxes:
Table 1: Transfer Syntax JPEG Compression Support
Compression Type |
Transfer Syntax UID |
Description |
Supported Image Bit-Depth (Bits Stored) |
JPEG Baseline |
1.2.840.10008.1.2.4.50 |
Default Transfer Syntax for Lossy JPEG 8 Bit Image Compression.¹ |
8-bit |
JPEG Extended
(Process 2 & 4) |
1.2.840.10008.1.2.4.51 |
Default Transfer Syntax for Lossy JPEG 12 Bit Image Compression (Process 4 only).¹ |
8-bit, 12-bit |
JPEG Lossless, Non-Hierarchical |
1.2.840.10008.1.2.4.70 |
Lossless JPEG Image Compression. First-Order Prediction (Process 14 [Selection Value 1]).¹ |
8-bit, 12-bit, 16-bit |
JPEG 2000, Lossless Only |
1.2.840.10008.1.2.4.90 |
Lossless, reversible wavelet and color component transformation, and no quantization.¹ |
8-bit, 12-bit, 16-bit |
JPEG 2000, Lossy |
1.2.840.10008.1.2.4.91 |
Lossy, irreversible wavelet transformation and color component transformation, and optional quantization.¹ |
8-bit, 12-bit, 16-bit |
¹ Note: The IDL DICOMEx JPEG and JPEG 2000 compression/decompression functionality is provided by the
Pegasus Imaging Corporation. By default, using any of the JPEG 2000 compression transfer syntaxes through an IDL DICOMEx object will cause the Pegasus evaluation splash screen to appear. However, IDLffDicomEx JPEG read/write compression functionality is still available. For details about licensing the Pegasus JPEG compressor/decompressor library to disable the evaluation splash screen and also to remove evaluation mode performance limits, please see the file "MERGECOM.PRO", located in the "bin/bin.[platform]/dicomex" directory of your IDL 6.1 installation (refer to line 447 of the document from a Windows installation or line 451 of the document from a UNIX installation).
The example program "dicom_changecompression_doc", included on the IDL Help reference page for "IDLffDicomEx::ChangeTransferSyntax", illustrates the use of the
TRANSFER_SYNTAX property and the
ChangeTransferSyntax method.
Notice however that the example program "dicom_changecompression_doc" will work with some single-sample-per-pixel files like the example file "mr_brain.dcm", but not with others like "mr_knee.dcm" (both of which are included in the example/data subdirectory of the IDL distribution). This is because the transfer syntax UID ("1.2.840.10008.1.2.4.51") being applied will work with 12-bit depth images but not with 16-bit depth images. The file "mr_brain.dcm" contains 12-bit depth image data, whereas "mr_knee.dcm" contains a 16-bit depth image. The following is an excerpt from the ChangeTransferSyntax method help page:
IF vBits NE 8 THEN BEGIN
; If vBits not equal to 8 then compress the file using
; JPEG Extended lossy compression.
oImg->ChangeTransferSyntax, '1.2.840.10008.1.2.4.51'
ENDIF
In this case, if a transfer syntax UID that supports both 12-bit and 16-bit depth images, like "1.2.840.10008.1.2.4.91", is applied instead, then the program will work with both files "mr_brain.dcm" and "mr_knee.dcm". For example:
oImg->ChangeTransferSyntax, '1.2.840.10008.1.2.4.91'
Notice also that the example "dicom_changecompression_doc" program uses the BITS_ALLOCATED image data property instead of the BITS_STORED property of a DICOM file to determine what transfer syntax UID is appropriate to apply to the data.
; Get the current transfer syntax.
oImg->GetProperty, TRANSFER_SYNTAX = vSyntax, $
BITS_ALLOCATED = vBits
However, it is the BITS_STORED property that actually corresponds to the "bit-depth" of an image. Bit-depth (of a single-sample-per-pixel image) can be defined as the relevant number of bits stored for a single pixel of image data. The stored data for each pixel is held within allocated chunk of data that may be as large as or larger than the BITS_STORED size, and so there may be unused bits in each chunk. On the other hand, the BITS_ALLOCATED property indicates the bit size of allocated chunk used to hold the data for each pixel. For example an image may be have BITS_STORED=12 (12-bit depth) at the same time that its BITS_ALLOCATED=16. Additionally, a 16-bit depth (BITS_STORED=16) image will likely have BITS_ALLOCATED=16.
Available for download is a modified version of the example program "dicom_changecompression_doc" that will successfully handle DICOM files with 8-bit, 12-bit and 16-bit depth image data. Right-click here to download modified example program "dicom_changecompression_doc2.pro".