LAUREL BRIDGE

Program Class

DICOM Connectivity Framework V3.4
OpenJpeg has created a high performance library that may be utilized in DCF as a replacement for the Jasper codecs for the J2k90 and J2k91 transfer syntax. The following example demonstrates how to select and configure the OpjCodecOptions class to perform various functions using the OpenJpeg codec.
Inheritance Hierarchy

SystemObject
  LaurelBridge.DCFExamples.OpenJpegProgram

Namespace:  LaurelBridge.DCFExamples.OpenJpeg
Assembly:  OpenJpeg (in OpenJpeg.exe) Version: DCF34 r13043 DCF_3_4_56_20220408 NetFramework
Syntax

C#
public class Program

The Program type exposes the following members.

Constructors

  NameDescription
Public methodProgram
Initializes a new instance of the Program class
Top
Methods

  NameDescription
Public methodStatic memberMain
Main entry point for OpenJpeg.
Top
Remarks

This program will open a file specified on the command line (mr-knee.dcm by default), and perform the following functions:

  • Transcode the DICOM file using the OpenJpeg codec to a lossless JPEG 2000 .90 compression with 5 compression ratios. Each compression ratio defines a layer in the resultant JPEG 2000 progressive data stream.
  • Open the lossless DICOM .90 file using the OpenJpeg codec and decode each progressive layer of the first frame as 24bit PNG to mr-knee-lossless.png using DicomImage.
  • Open the lossless DICOM .90 file and save each progressive layer of the first frame as the raw JPEG 2000 code stream.
  • Open the lossless DICOM .90 file and save each progressive layer of all frames as a new lossy DICOM file. The lossy DICOM file will also be updated to be marked as lossy. Note that this also occurs when all 5 layers are used even though the resultant data stream is actually lossless.

Caveats:

  • This example expects datasets with either 24 bit color, or 8 or 16 bit monochrome.
  • Palette color images will throw an exception; to create a lossy version they must be first converted to RGB.
  • DICOM mandates the use of the J2K codestream; conversion of JP2 format is currently not implemented.
  • The conversion process expects exactly one tile per layer which is what is produced by the first step; different J2kOverrides may negatively affect the pruning implementation.

Also see the CodecConfiguration example that describes several alternatives to configuration of codecs.

See Also

Reference