Question

DicomDroid.jar used to open a .dcm formated image in my Android application. I got the follwing exception when try to open it.

java.io.IOException: DICOM JPEG compression not yet supported

Adding my code below

try {



    // Read the imagefile into a byte array (data[])
                File imagefile = new File(path);
                byte[] data = new byte[(int) imagefile.length()];
                FileInputStream fis = new FileInputStream(imagefile);
                fis.read(data);
                fis.close();

                // Create a DicomReader with the given data array (data[])
                DicomReader DR = new DicomReader(data);

} catch (Exception ex) {

Log.e("ERROR", ex.toString());

}

What can be done to avoid this error?

Thanks in advance.

Was it helpful?

Solution

The cause is pretty obvious. That DICOM library doesn't support that particular kind of DICOM file.

There's not much you can do about it ... unless you are prepared to enhance the library yourself.


But I think you have probably made a mistake in setting up your instrument to generate DICOM files with JPEG compression. JPEG is lossy, and best practice is to capture and store images with the best resolution feasible. If you need to downgrade resolution to reduce bandwidth, it would be better to

  1. save a high resolution DICOM,
  2. convert the DICOM to a low resolution JPG, and
  3. send the JPEG.

OTHER TIPS

Another option is to get the Dicom file in an uncompressed format (ej: Explicit VR Little Endian). This is the simplest dicom file format and every dicom library has support for such format.

So, when you get your Dicom file from your PACS, force this transfer syntax. This way, your dicom library will be able to deal with the image file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top