Hi Deepak,
First some background: The codecs uses are OpenJPEG for JPEG2000 support, and the IJG code for standard JPEG compression. The basic code was taken from the
mDCM library (which was the original basis of our entire DICOM library). This is partially the reason for our recent change in licensing of the code. We did make some modifications to interfaces from the mDCM codec code. Specifically, the interfaces were changed to allow greater flexibility and the potential for a plugin type interface for setting compression/decompression parameters.
As for how to build the library, the OpenJPEG and IJG code are compiled within managed C++ code. If you load the solution Trunk\Dicom\ClearCanvas.Dicom.sln, the projects for building the codecs are included in this solution. The compiled versions of the codec assemblies are also checked into Trunk\ReferencedAssemblies.
Codecs are registered via the static DicomCodecRegistry class. Here is some sample code to register the current codecs:
DicomCodecRegistry.RegisterCodec(TransferSyntax.JpegBaselineProcess1,
new DicomJpegProcess1CodecFactory());
DicomCodecRegistry.RegisterCodec(TransferSyntax.JpegExtendedProcess24,
new DicomJpegProcess24CodecFactory());
DicomCodecRegistry.RegisterCodec(TransferSyntax.JpegLosslessNonHierarchicalProcess14,
new DicomJpegLossless14CodecFactory());
DicomCodecRegistry.RegisterCodec( TransferSyntax.JpegLosslessNonHierarchicalFirstOrderPredictionProcess14SelectionValue1,
new DicomJpegLossless14SV1CodecFactory());
DicomCodecRegistry.RegisterCodec(TransferSyntax.Jpeg2000ImageCompressionLosslessOnly,
new DicomJpeg2000LosslessCodecFactory());
DicomCodecRegistry.RegisterCodec(TransferSyntax.Jpeg2000ImageCompression,
new DicomJpeg2000LossyCodecFactory());
DicomCodecRegistry.RegisterCodec(TransferSyntax.RleLossless,
new DicomRleCodecFactory());
The above use of the DicomCodecRegistry can be done with just the ClearCanvas.Dicom assembly and the correct assembly containing the codec being registered. We've also added an extension point for codecs, and a DicomCodecHelper class in the ClearCanvas.DicomServices assembly to help loading the extensions. The ImageServer code base has implemented the plugin mechanism. You can look at the ClearCanvas.ImageServer.Codec.* assemblies to see how this is done.
Finally, the DICOM library itself has a few ways to do conversions. The DicomMessageBase class has a ChangeTransferSyntax() method that can be used to do conversions of DICOM files or messages between supported transfer syntaxes. Also, the SendCStoreRequest method of DicomClient has been modified to do a single conversion of an object, if necessary, when sending over the network. (Ie, it can decompress or compress an object to match w/ the negotiated transfer syntax for the object.)
There's also been some mods with the library for accessing frames, and the ability to leave pixel data on disk when reading a file, and then read the data frame by frame from a compressed file on disk. (The viewer is now doing this.)
Overall, the codec code hasn't been extensively tested yet. We have done a bit more testing of decompression than compression with this code. The API, however, is fairly stable, and I wouldn't expect many changes with it at this time.
regards,
Steve