Sunday, February 14, 2010

DICOM JPEG 2000 Decoding in RZDCX Release 1.0.1.1

[update 24 March 2023: latest HRZ softwarecan be found on HRZ website - www.hrzkit.com]

The new preliminary release of the Fast Strike DICOM Toolkit, RZDCX, adds JPEG 2000 support for communication and decoding. The function Decode of the DCXOBJ class decodes JPEG  2000 DICOM images just like it does for jpeg, jpeg lossless and RLE.
The function SaveBitmap of the DCXIMG class also handles jpeg 2000 in the same manner.

The following sample code snippet shows how to decode a JPEG 2000 image using the Decode function and save it as a new decompressed DICOM file:


            DCXOBJ image = new DCXOBJ();
            String filename = "DCMJ2K";
            image.openFile(filename);
            image.Decode();
            image.saveFile("DCMLEE");

Another little feature of this release is the TransferSyntax property (set only) that can be used to encode or decode objects or explicitly set the transfer syntax, for example to store objects as little endian implicit or big endian implicit. Up until now, created objects could have been stored either as little endian explicit or with one of the supported compressed formats (jpeg, jpeg lossles and rle).
The following code shows how to save files as LEI:

            DCXOBJ image = new DCXOBJ();
            /// ... add elements in
            image.TransferSyntax = TS_LEI;


            image.saveFile("DCMLEI");

The new release is on the downloads page at downloads.hrzkit.com


2 comments:

  1. Kind of tedious here but now I see the saveFile option. I wrote this little method to make setting the element process a little easier.

    static private void SetElement(ref DCXOBJ o, DICOM_TAGS_ENUM enumerable, object value)
    {
    DCXELM e = new DCXELM();
    e.Init((int)enumerable);
    e.Value = value;
    o.insertElement(e);
    }

    ReplyDelete