ImageGear for Java
Loading and Saving DICOM Images

Load DICOM images in the same way as you load images of other formats. Use DICOM format options to set specific features for image loading.


Save DICOM images in the same way as you save images of other formats. However, there are a few items that need to be discussed about saving DICOM images. This section provides information about the following:

Transfer Syntaxes

There are two ways to specify transfer syntax (compression) for DICOM image saving: SaveFormat parameter, and TransferSyntax DICOM format option. SaveFormat is an easy-to-use shortcut, while TransferSytnax option provides the full selection of transfer syntaxes for image saving.

ImGearSavingFormats  ImGearCompressions  Transfer Syntax
DICOM  AUTO  Defined by SaveSyntax option
DICOM_UNCOMP NONE  ImplicitLittleEndian
DICOM_RLE  RLE  RLE 
DICOM_JPEG  JPEG  JPEG Lossy
DICOM_JPEG2K  JPEG2K  JPEG2K Lossy

Saving DICOM Images Using JPEG Compression

The supported modes are:
 

JPEG Lossy Baseline or Extended

This is the default mode for saving DICOM images with JPEG compression in ImageGear. In this mode:

If the source image colorspace is different from RGB or grayscale, or the bit depth is greater, ImageGear automatically converts image rasters to one of the supported pixel formats on saving. See PixelFormat ConversionduringImageSaving for more details.

As part of JPEG Lossy compression process, ImageGear converts RGB rasters into YCbCr colorspace (or YCC in DICOM terminology) during saving. This conversion is fully encapsulated into the ImageGear JPEG codec; the application should not convert images to YCbCr before saving them to JPEG or DICOM JPEG.

Use one of these ways to save an image as DICOM JPEG Baseline or Extended:

JPEG Lossy Baseline Only

This mode provides compatibility with viewers that do not support JPEG Extended coding process (12-bit images). In this mode:

If the source image colorspace is different from RGB or grayscale, or the bit depth is greater, ImageGear automatically converts image rasters to one of the supported pixel formats on saving. See Pixel Format Conversion during Image Saving for more details.

As part of the JPEG Lossy compression process, ImageGear converts RGB rasters into YCbCr colorspace (or YCC in DICOM terminology) during saving. This conversion is fully encapsulated into the ImageGear JPEG codec; the application should not convert images to YCbCr before saving them to JPEG or DICOM JPEG.

To save an image as DICOM JPEG Baseline, use ImGearSavingFormats.DICOM saving format, and set SaveSyntax to ImGearDICOMTransferSyntaxes.JPEG_BASELINE_PR_1.

JPEG Lossless

In this mode:

JPEG Lossless compression does not involve internal conversion or RGB rasters into YCbCr colorspace (YCC in DICOM terminology).

To save an image as DICOM JPEG Lossless, use ImGearSavingFormats.DICOM saving format, and set SaveSyntax to ImGearDICOMTransferSyntaxes.JPEG_LOSSLESS or ImGearDICOMTransferSyntaxes.JPEG_LOSSLESS_NONH_PR_14.

Saving DICOM Images Using RLE Compression

DICOM provides a mechanism for supporting the use of Run Length Encoding (RLE) Compression, which is a byte oriented lossless compression scheme.

If the source image color space is different from RGB or grayscale, or the bit depth is greater, ImageGear automatically converts image rasters to one of the supported pixel formats on saving. See Pixel Format Conversion during Image Saving for more details.

Use one of the following to save an image as DICOM RLE:

Saving Non-DICOM Images to DICOM Format

ImageGear for Java allows saving of non-DICOM images to DICOM format. A default Secondary Capture DataSet is created for such images.

Saving Multiframe Images

The DICOM format is not designed for an easy insertion of pages. The following issues exist:

According to the above issues, DICOM format filter in ImageGear for Java has the following limitations:

If any of the limitations are encountered, ImageGear throws an exception.

To save a multipage image:

  1. Load an image into an ImGearPage.
  2. Save image to a new file (or use OVERWRITE mode).
  3. Load the next image into an ImGearPage.
  4. Save the image to the existing file, using APPEND mode.
  5. Repeat steps 3 and 4 for all pages to be written.

Alternatively, create an ImGearDocument object, loading all images as ImGearPage objects in the document, and save the ImGearDocument as DICOM using the SaveDocument method.

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback