knopkem / dicomweb-proxy

A proxy to translate between dicomweb and traditional dicom dimse services (PACS communication)
Other
68 stars 19 forks source link

Apply Quality Factor during lossy compression. #81

Closed radyworks closed 2 years ago

radyworks commented 2 years ago

Thank you for this lovely solution - this is a life extender for most of our legacy PACS with good web viewer like OHIF. We are looking to deploy this solution for Remote X-Ray Reporting using OHIF viewer. We found the compression option config.transferSyntax very helpful for lossless compression.

For our X-rays we like to use quality factor with following transfer syntax. 1.2.840.10008.1.2.4.51 JPEG Baseline (Processes 2 & 4) - Lossy JPEG 12-bit Image Compression 1.2.840.10008.1.2.4.81 JPEG-LS Lossy (Near- Lossless) Image Compression 1.2.840.10008.1.2.4.91 JPEG 2000 Image Compression

Is there a way to set a quality factor to improve the download speed for remote reading. We prefer to set quality factor at 80 will really help to know if there is any way to set this in config file.

regards Rady

knopkem commented 2 years ago

Hi, thanks for the kind words, I'm glad you find some use for it. Currently there is no way of setting the quality factor via the config. It would need an update of the underlying dicom-dimse-native dependency. I'll update it asap as this should not be hard to do and I find it useful too. I'll post an update here once it's done. Cheers

knopkem commented 2 years ago

Hi, just released a new version with a new config parameter (lossyQuality). Unfortunately it seems that the underlying dcmtk toolkit does only support quality factor for jpeg lossy, not ls, not j2k. Cheers

radyworks commented 2 years ago

Thank you for the amazing speed, for a opensource project this is a very quick response.

Hope you can take a look at https://github.com/Efferent-Health/fo-dicom.Codecs

This is collaborative project maintained by Fellow Oak Dicom and Efferent Health, LLC. The codecs in this repository are written in pure C/C++ code and wrapped with C# and netstandard2.0.

In this we are able to do all lossy compression with decent performance.

radyworks commented 2 years ago

Thank you for responding to our earlier request. This implementation is hit with a small issue (could be on our side). The lossy factor is applied to already compressed (received via c-get or c-move) file, as a result

  1. Some of the j2k files in our archive (though OHIF viewer supports J2k) this project converts them to JPEG lossy. This takes up a lot of processing power on our VM (recompression).
  2. This re-compress conversion process we are loosing the complete image, OHIF viewer displays them as black image.

Is there a possibility / configuration to apply compression only on the RAW image (TS listed below) not already compressed image.

  1. 1.2.840.10008.1.2 Implicit VR Endian: Default Transfer Syntax for DICOM
  2. 1.2.840.10008.1.2.1 Explicit VR Little Endian
  3. 1.2.840.10008.1.2.1.99 Deflated Explicit VR Little Endian
  4. 1.2.840.10008.1.2.2 Explicit VR Big Endian

Thank you for the great work you have put in.

knopkem commented 2 years ago

Sounds reasonable, will add an option for this asap.

On Mon, May 23, 2022 at 12:15 AM Ravindran Padmanabhan < @.***> wrote:

Thank you for responding to our earlier request. This implementation is hit with a small issue (could be on our side). The lossy factor is applied to already compressed (received via c-get or c-move) file, as a result

  1. Some of the j2k files in our archive (though OHIF viewer supports J2k) this project converts them to JPEG lossy. This takes up a lot of processing power on our VM (recompression).
  2. This re-compress conversion process we are loosing the complete image, OHIF viewer displays them as black image.

Is there a possibility / configuration to apply compression only on the RAW image (TS listed below) not already compressed image.

  1. 1.2.840.10008.1.2 Implicit VR Endian: Default Transfer Syntax for DICOM
  2. 1.2.840.10008.1.2.1 Explicit VR Little Endian
  3. 1.2.840.10008.1.2.1.99 Deflated Explicit VR Little Endian
  4. 1.2.840.10008.1.2.2 Explicit VR Big Endian

Thank you for the great work you have put in.

— Reply to this email directly, view it on GitHub https://github.com/knopkem/dicomweb-proxy/issues/81#issuecomment-1133998535, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHSZXUWAHTKY2M2C4BQ7HDVLKWYRANCNFSM5UJULNHA . You are receiving this because you commented.Message ID: @.***>

knopkem commented 2 years ago

Sorry was quite busy but V1.7.0 should now work as described above (I did not yet make it an option, it doesn't recompress by default now). If you find some issues with it, just add a new issue. Cheers