codecs

CODECs (COder and DECoder) for JPEG, JPEG2000 and RLE

Since version 1.3 dcm4che supports several transfer syntaxes for encapsulation of encoded pixel data:

PS 3.5 - Annex A.4 Transfer Syntaxes for Encapsulation of Encoded Pixel Data

Transfer Syntax UID

Description

1.2.840.10008.1.2.4.50

JPEG Baseline (Process 1): Default Transfer Syntax for Lossy JPEG 8 Bit Image Compression

1.2.840.10008.1.2.4.51

JPEG Extended (Process 2 & 4): Default Transfer Syntax for Lossy JPEG 12 Bit Image Compression (Process 4 only)

1.2.840.10008.1.2.4.57

JPEG Lossless, Non-Hierarchical (Process 14)

1.2.840.10008.1.2.4.70

JPEG Lossless, Non-Hierarchical, First-Order Prediction (Process 14 [Selection Value 1]): Default Transfer Syntax for Lossless JPEG Image Compression

1.2.840.10008.1.2.4.80

JPEG-LS Lossless Image Compression

1.2.840.10008.1.2.4.81

JPEG-LS Lossy (Near-Lossless) Image Compression

1.2.840.10008.1.2.4.90

JPEG 2000 Image Compression (Lossless Only)

1.2.840.10008.1.2.4.91

JPEG 2000 Image Compression

PS 3.5 - Annex G Encapsulated RLE Compressed Images

Transfer Syntax UID

Description 

1.2.840.10008.1.2.5

RLE (Run Length Encoding) Lossles

Coding and encoding of the JPEG pixel data is done using the Image I/O API, which is part of the Java 2 Platform Standard Edition. By default the J2SE includes CODECs for PNG and JPEG as well as a decoder for GIF. As the built-in JPEG CODEC does not support all functionallity needed by the transfer syntaces, additional CODECS are used, which are distributed under the name JAI Image I/O(http://java.sun.com/products/java-media/jai/downloads/download-iio-1_1.html). This CODEC package has been packaged with JAI (Java Advanced Imaging) since the release of JAI 1.0. The image formats supported by these ancillary codec classes are: BMP, GIF (decoder only), FlashPix (decoder only), JPEG, JPEG2000, PNG, PNM, TIFF, and WBMP. The latest version distributed by SUN is 1.1 (October 2006). The JAI Image I/O package is now licensed under the open source Berkeley Software Distribution (BSD) License. The latest developer version is available at https://jai-imageio.dev.java.net(jai-imageio-1_2-pre-dr-b04, 2006-12-01).

The JAI Image I/O package is not a pure Java implementation: Some of its functions are implemented in native code, some CODECs are accelerated by additional native classes. If available, the pure Java implementation is used if the native library could not be found.

Coding and encoding of the RLE pixel data is done by a CODEC of the dcm4che project, which is included as the separate archive dcm4che-imageio-rle-2.0.19.jar within the distribution.

Using the CODECs

To ease the setting of the classpath, dcm4che includes several archives implicitely from within the MANIFEST.MF of the dcm4che.jar file. Therefore the archives

log4j.jar
dcm4che-imageio-rle-2.0.19.jar
jai_imageio.jar
clibwrapper_jiio.jar
jai_imageio_api.zip

are added automatically to the classpath as long as dcm4che.jar is part of the classpath and the archives reside in the same directory as dcm4che.jar.

1.If the application does not use encoded pixel data:

In this case it is not neccessary to include the JAI Image I/O package or the RLE archive into the classpath. To ensure a reliable functionality of dcm4che, the archive

jai_imageio_api.zip

should be included into the classpath. The archive is part of the binary distribution of dcm4che and includes the required subset of classes of the JAI Image I/O package. If the archive resides in the same directory as dcm4che.jar, it is included implicitly into the classpath by the MANIFEST of dcm4che.jar.

2. If the application uses encoded pixel data:

The RLE CODEC dcm4che-imageio-rle-2.0.19.jar must be included into the classpath. This is done implicitly, if dcm4che.jar is part of the classpath and the archive reside in the same directory as dcm4che.jar.

a) Using the installer of the JAI Image I/O package

As the JAI Image I/O package requires native libraries, Sun provides separate downloads for Windows, Linux, Solaris SPARC and Solaris x86. Download and install the JDK and/or JRE version, depending of what type of Java 2 Platform is installed on the host system. If both a JDK and a JRE make sure that the JAI Image I/Opackage is installed for the virtual machine that will be invoked by the application.

On Macintosh OS X systems the JAI Image I/O package is installed as part of the JAI package by default.

b) Custom installation of the JAI Image I/O package

The binary distribution of dcm4che already includes the required files of the JAI Image I/O package for Windows and i568 Linux:

Library File

Description

lib/clibwrapper_jiio.jar

CcodecLib JNI interfaces.

lib/jai_imageio.jar

JAR file containing core JAI Image I/O class files.

bin/clib_jiio.dll

codecLib JNI DLL libraries. (Microsoft Windows operating environment)

bin/libclib_jiio.so

codecLib JNI shared libraries. (Linux operating environment)

Both JAR archives are implicitly included in the classpath, ifdcm4che.jaris part of the classpath and the archives reside in the same directory as dcm4che.jar.

The directory in which the codecLib JNI DLL libraries resides, must be included into PATH system variable (Windows) or LD_LIBRARY_PATH (Linux). In a Windows environment the PATH system variable can be set by selecting System Properties, Advanced tab, Environment Variable button. Append the directory path ofclib_jiio.dllpreceeded by a ';'. The new value of the PATH variable is valid without the need of a restart. To check the content of PATH variable in a command window, type set PATH.

JAI Image I/O

Java Advanced Imaging Image I/O Tools will be installed under the $JDK directory with the files in the locations given in the following table. The same files will appear in analogous locations in the JRE installation. In the CLASSPATH installation they will be located in the installation directory and its lib subdirectory.

File

Description

COPYRIGHT-jai_imageio.txt

Copyright notice.

UNINSTALL-jai_imageio

Uninstall script (Solaris and Linux operating environments only).

LICENSE-jai_imageio.txt

License agreement.

jre/lib/ext/jai_imageio.jar

JAR file containing core JAI Image I/O class files.

jre/lib/ext/clibwrapper_jiio.jar

codecLib JNI interfaces.

jre/lib/i386/libclib_jiio.so

codecLib JNI shared libraries. (Linux operating environment)

jre/bin/clib_jiio.dll

codecLib JNI DLL libraries. (Microsoft Windows operating environment)

If use of native code is disallowed then the JPEG and PNG reader-writer plug-ins and some accelerations used for bilevel TIFF compression will not be available, nor will the native Implementation of the JPEG 2000 reader-writer plug-in; the Java implementation of the JPEG 2000 plug-in will however be available. The respective plug-ins will detect that native libraries cannot be used and respond accordingly.

Links

Installation: http://java.sun.com/products/java-media/jai/INSTALL-jai_imageio-1_1.html

Features: http://java.sun.com/products/java-media/jai/RELEASE-jai_imageio_1_1.html

Introduction to the API: http://java.sun.com/j2se/1.4.2/docs/guide/imageio/spec/imageio_guideTOC.fm.html

Description of the CODECs: http://java.sun.com/products/java-media/jai/forDevelopers/jai-imageio-1_1-alpha-docs/overview-summary.html

Implementation

Mapping of transfer syntaxes

Inside the dcm4che package the encapsulated transfer syntaxes are mapped to a CODEC by the property file org/dcm4cheri/image/ImageReaderFactory.properties:

Transfer Syntax UID

Property

1.2.840.10008.1.2.5

org.dcm4che2.imageioimpl.plugins.rle.RLEImageReader

1.2.840.10008.1.2.4.50

com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReader

1.2.840.10008.1.2.4.51

com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReader

1.2.840.10008.1.2.4.57

com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReader

1.2.840.10008.1.2.4.70

com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReader

1.2.840.10008.1.2.4.80

com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReader

1.2.840.10008.1.2.4.81

com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReader

1.2.840.10008.1.2.4.90

com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageReaderCodecLib

1.2.840.10008.1.2.4.91

com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageReaderCodecLib

Classes in the archive jai_imageio_api.zip:

com/sun/media/imageio/stream/SectorStreamSegmentMapper.class
com/sun/media/imageio/stream/SegmentedImageInputStream.class
com/sun/media/imageio/stream/StreamSegment.class
com/sun/media/imageio/stream/StreamSegmentMapper.class
com/sun/media/imageio/stream/StreamSegmentMapperImpl.class