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
LaurelBridge.DCF.Examples.OpenJpegProgram
Namespace: LaurelBridge.DCF.Examples.OpenJpeg
Assembly: OpenJpeg (in OpenJpeg.exe) Version: DCF34 r11538 DCF_3_4_24_20190319
Syntax
C#
public class Program
The Program type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Program | Initializes a new instance of the Program class |
Methods
Name | Description | |
---|---|---|
Main |
Main entry point for OpenJpeg.
|
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