Suggestion on Compression Optimization

Hello everyone,
Hope you all are doing well .
I need a suggestion related to optimiszing compression. I am compressing study while transferring study from local orthac to cloud orthanc .
Orginal file size was 205 MB and after compression that become 152 MB. I used transfer syntax 1.2.840.10008.1.2.4.91 for compression below is my lua script that I used on my local system.

  function OnStableStudy(studyId, tags, metadata)
      local moveRequest = {}
      moveRequest["Asynchronous"] = true
      moveRequest["Transcode"] = "1.2.840.10008.1.2.4.91"
     RestApiPost("/peers/NEOS_PRIMARY/store", DumpJson(moveRequest, false))

end

But when I compressed same file from mac system by using horos software (another software for viewing dicom files) that same file size become 20.7 MB . In Horos for compression I select jpeg 2000 low quality compression .

My question , is that same thing can be achieved in orthanc where my study size can be reduced from 205 MB to 20.7 MB. ?

It will be highly greatfull to have a valuable suggestion of all on it .
I will be happy to share more details on it
Thanks You
Ankush Gupta

1 Like

Hi,

If you are using JP2K lossy compression, it is not possible to change the compression quality.

However, if you use 1.2.840.10008.1.2.4.51 or 1.2.840.10008.1.2.4.50 then, you can use this configuration option to select it:

  // The compression level that is used when transcoding to one of the
  // lossy/JPEG transfer syntaxes (integer between 1 and 100).
  "DicomLossyTranscodingQuality" : 90,

HTH,

Alain

Hey @alainmazy ,
Thankyou for response ,
I tried the suggestion provided you but files are not compressed into the transcode syntax 1.2.840.10008.1.2.4.50 or 1.2.840.10008.1.2.4.50 .
it stay with its original transcode syntax which is Implicit VR Little Endian [1.2.840.10008.1.2]

Is there any other things that I can try ? any help would be great.

Thank you
Ankush

These 2 transfer syntaxes only works with certain images (one for 8 bits and the other one for 12 bits image).

There are no other solutions from Orthanc directly - we usually don’t work with lossy compression in human imaging.

You may try to use gdcmconv to compress files with another quality factor outside Orthanc …

Okay ,
is that possible I can use gdcmconv with lua script ?
or any other way possible can be achieved with lua ?

Thankyou

yes. with os.execute()

thank you

As per my knowledge. Lua work with gdcm only in OnstoreInstance() .
File comes to orthanc ,as soon as any instance received, OnstoreInstance() function runs and inside that received instance being downloaded and then converted to compressed form and then re-upload as well as deleted the original instance .

With all these process their will be a huge computer resources consumption.

Is there any possiblity I can use gdcm with OnstableStudy or OnstableSeries function

right now I can’t things of possiblility of being using gdcm with OnstableStudy or OnstableSeries

any suggestion on this will be huge help for me.

Thank you
Ankush Gupta

Yes you can use GDCM on OnStableStudy. You’ll just have to retrieve all instances id by calling the RestAPI from Orthanc with RestApiGet('/studies/../instances') and then apply the compression one instance at a time.

From the workload perspective, this looks quite equivalent to performing it on OnStoredInstance

Yes, you are right
thank you so much for all suggestion and help.