cornerstoneWADOImageLoader icon indicating copy to clipboard operation
cornerstoneWADOImageLoader copied to clipboard

JPX Error: Unsupported COD options (selectiveArithmeticCodingBypass)

Open Neuroforge opened this issue 6 years ago • 10 comments

Hello,

I am receiving the follow error when loading images. This is one particular set of dicom images work in RadiAnt and with the online demo.(https://rawgit.com/cornerstonejs/cornerstoneWADOImageLoader/master/examples/dicomfile/index.html)

Uncaught Error: JPX Error: Unsupported COD options (selectiveArithmeticCodingBypass)
    at a.parseCodestream (wado-image-loader-codecs.min.js:3)
    at a.parse (wado-image-loader-codecs.min.js:3)
    at wado-image-loader-web-worker.min.js:2
    at t.default (wado-image-loader-web-worker.min.js:2)
    at t.default (wado-image-loader-web-worker.min.js:2)
    at Object.handler (wado-image-loader-web-worker.min.js:2)
    at self.onmessage (wado-image-loader-web-worker.min.js:2)
let webWorkerUrl = "/assets/js/wado-image-loader-web-worker.min.js"
let codecsUrl = "/assets/js/wado-image-loader-codecs.min.js"

let webWorkerConfig = {
  maxWebWorkers: Math.max(navigator.hardwareConcurrency||1, 4),
  startWebWorkersOnDemand: false,
  webWorkerPath: webWorkerUrl,
  webWorkerTaskPaths: [],
  taskConfiguration: {
    decodeTask: {
      loadCodecsOnStartup: true,
      initializeCodecsOnStartup: false,
      codecsPath: codecsUrl,
      usePDFJS: true,
      strict: true
    }
  }
}

cornerstoneWADOImageLoader.webWorkerManager.initialize(webWorkerConfig);

Most images work fine, but this set seems to be causing an uncaught exception.

It appears to occur with the image-JPEG2000 codec.

Any thoughts or advice would be appreciated.

This google group conversation seems similar, but not identical. https://groups.google.com/forum/#!topic/cornerstone-platform/nLebuvcZxuA

Neuroforge avatar Jan 17 '19 02:01 Neuroforge

Can you share one such DICOM instance ?

malaterre avatar Jan 17 '19 08:01 malaterre

Hello @malaterre ,

Unfortunately, they have patient information attached to them. If i use DicomCleaner to remove patient information, then something strange happens. There are 50 images in total, but the loader is able to process 30 of them after being processed with DicomCleaner.

Do you have an email address where i could send one image to you in confidence? I do not wish to post them publicly on Github. Or can you recommend another method to remove the data without changing the image format.

Regards,

Daniel

Neuroforge avatar Jan 17 '19 09:01 Neuroforge

@Neuroforge Two things:

  1. Can you try harder and reduce the issue to a single file.
  2. Download gdcm and use gdcmraw + gdcmimg to craft an example without PHI meta data.

Typical steps:

$ gdcmraw input_j2k.dcm output.j2k
$ gdcmimg output.j2k output_nophi.dcm

WARNING: Do not post publicly if name of patient can be found somewhere on the image itself (pixel data element).

malaterre avatar Jan 17 '19 09:01 malaterre

The patient data is in the image itself. :/

Johns-MBP:Dicom johnbell$ gdcmimg xxxxxxxxx.dcm output.j2k Johns-MBP:Dicom johnbell$ gdcmimg output.j2k output_nophi.dcm Expected a SOC marker Could not read: output.j2k

I have tried DicomCleaner again, but with the same result.

Neuroforge avatar Jan 17 '19 09:01 Neuroforge

The patient data is in the image itself. :/

Johns-MBP:Dicom johnbell$ gdcmimg xxxxxxxxx.dcm output.j2k Johns-MBP:Dicom johnbell$ gdcmimg output.j2k output_nophi.dcm Expected a SOC marker Could not read: output.j2k

I have tried DicomCleaner again, but with the same result.

Just for later reference gdcmimg != gdcmraw.

malaterre avatar Jan 18 '19 09:01 malaterre

Any update?

evanzombie avatar Feb 15 '19 18:02 evanzombie

This appears to be a decoding issue? I'm going to move this to cornerstoneWADOImageLoader's repo.

Without a minimal reproduction, this is incredibly hard to troubleshoot or provide guidance on.

dannyrb avatar Mar 24 '19 16:03 dannyrb

I have the same problem. I solved this problem by converting the JPEG2000 to uncompressed image, and then converting the uncompressed image into JPEG2000 by using gdcm as following:

gdcmconv -w B:\90.dcm B:\UN.dcm
gdcmconv -k  B:\UN.dcm B:\New90.dcm

cylien avatar Aug 19 '20 10:08 cylien

@cylien Can you do this inside of the web app?

Neuroforge avatar Aug 19 '20 11:08 Neuroforge

Can you do this inside of the web app

It can be done by creating a web API to allow the user to upload the DICOM file to convert at the server-side by executing shell commands to generate the new DICOM file which returns to the client. For example, using the Node.js to implement it is a good method.

cylien avatar Aug 25 '20 12:08 cylien