0

I doing an image service to decompress dicom images ans save them as BMP(using dcmtk). Incase of jpeg2000 it is adviced to use OpenJPEG(2.1.1). How can i pass the compressed image to OpenJPEG and get Uncompressed image back. Suggestions are welcomed..

1 Answers1

1

Here is a simple way, since you are receiving DICOM with JPEG 2000 encapsulated stream in it, simply pass the DICOM directly to GDCM to uncompress it. Then forward the decompressed DICOM to your regular DCMTK pipeline:

$ gdcmconv --raw input_jp2.dcm output_raw.dcm

GDCM by default is build with OpenJPEG 2.1.x.

Of course, if you are familiar with C++, you could directly call the C++ API directly, in particular have a look at the class gdcm::ImageChangeTransferSyntax.

Reference:

malat
  • 12,152
  • 13
  • 89
  • 158
  • Hi malat. Iam completly new to dcmtk and openjpeg. It will be great with some codes for this. Thanks in advance. – Arunkumar Kathirvel Jul 25 '17 at 14:08
  • Well it depends on your language, but most should support something like calling an external process (eg. system()). – malat Jul 25 '17 at 15:07
  • **Iam working on c++. Do you mean like this.**System(opj_decompress.exe -i "INPUT_FILE_NAME" -o "OUTPUT_FILE_NAME")** – Arunkumar Kathirvel Jul 26 '17 at 04:49
  • I the above i need to give the input and output file names and only certain file extensions are supported for input and output files. But in my case the jpeg2000 file(with dicom image) will have no extension.So is it possible to send streams to openjpeg and do decpmression.If so, kindly give some sample – Arunkumar Kathirvel Jul 26 '17 at 06:00
  • Just use GDCM: [ImageChangeTransferSyntax](http://gdcm.sourceforge.net/2.8/html/CompressImage_8cxx-example.xhtml) – malat Jul 26 '17 at 06:09
  • my requirement is to use only openjpeg – Arunkumar Kathirvel Jul 26 '17 at 06:38