Jpeg2000 in osimis viewer

Hi,

My Orthanc is configured with StorageCompression:true
I wish to know the internal steps involved in viewing this image in osimis viewer over the internet

Q1. since the file is compressed using zlib due to StorageCompression:true, at the server will the osimis plugin/orthanc_server serve the file as it is or will it decompress and recompress while sending http data? I wish to understand the CPU/discIO costs

Q2, I took a 527kb raw dcm file, zipping it reduced the file to 264kb, which is about 50% compression. And jpeg2000 compression resulted in 221kb, thats about 58% compression. Difference of only 8. So is just StorageCompression:true good enough for most purposes? Or will using Jpeg2000 make a significant difference in disc/network cost?

Q3, Is there any plan to support an option like Jpeg2000StorageCompression :slight_smile:

Q4. Is jpeg2000 decompression natively supported across windows/mac/ipad/android platforms and across browsers?

Q5. If StorageCompression is set to false and if images are stored in jpeg2000 TS itself, will osimis plugin serve the image as it is?

Thanks

Hi,

Hi,

My Orthanc is configured with StorageCompression:true
I wish to know the internal steps involved in viewing this image in osimis viewer over the internet

Q1. since the file is compressed using zlib due to StorageCompression:true, at the server will the osimis plugin/orthanc_server serve the file as it is or will it decompress and recompress while sending http data? I wish to understand the CPU/discIO costs

Files are decompressed from disk to RAM before the plugin can use them.

Q2, I took a 527kb raw dcm file, zipping it reduced the file to 264kb, which is about 50% compression. And jpeg2000 compression resulted in 221kb, thats about 58% compression. Difference of only 8. So is just StorageCompression:true good enough for most purposes? Or will using Jpeg2000 make a significant difference in disc/network cost?

numbers speak for themselves…

Q3, Is there any plan to support an option like Jpeg2000StorageCompression :slight_smile:

You can use StorageCompression and JPEG2000 but zipping JPEG2000 files would not bring any further compression.

Q4. Is jpeg2000 decompression natively supported across windows/mac/ipad/android platforms and across browsers?

No, the JPEG2000 files need to be decompressed and re-compressed to JPG before the browser can decompress them. JPEG2000 decompression is very slow so it’s really not an optimal performance. RAW files are encoded into JPEG or PNG before being sent to the browser to reduce the bandwidth but PNG compression is very slow.

The best storage/speed compromise we’ve found so far is by using JPEG transfer syntax (lossless). With this TS, the files can be transferred as such to the browser that is able to decompress them.

Q5. If StorageCompression is set to false and if images are stored in jpeg2000 TS itself, will osimis plugin serve the image as it is?

See above.

Thanks Alain,

No, the JPEG2000 files need to be decompressed and re-compressed to JPG before the browser can decompress them. JPEG2000 decompression is very slow so it’s really not an optimal performance. RAW files are encoded into JPEG or PNG before being sent to the browser to reduce the bandwidth but PNG compression is very slow.

Is that JPEG/PNG compression lossy or lossless?
Is there an option to disable PNG since compression is slow?

The best storage/speed compromise we’ve found so far is by using JPEG transfer syntax (lossless). With this TS, the files can be transferred as such to the browser that is able to decompress them.

With some effort I can C-STORE the image in JPEG-LS format, but is there any built-in option to make Orthanc store the image in JPEG-LS?

Thanks

Thanks Alain,

No, the JPEG2000 files need to be decompressed and re-compressed to JPG before the browser can decompress them. JPEG2000 decompression is very slow so it’s really not an optimal performance. RAW files are encoded into JPEG or PNG before being sent to the browser to reduce the bandwidth but PNG compression is very slow.

Is that JPEG/PNG compression lossy or lossless?

Lossless

Is there an option to disable PNG since compression is slow?

No

The best storage/speed compromise we’ve found so far is by using JPEG transfer syntax (lossless). With this TS, the files can be transferred as such to the browser that is able to decompress them.

With some effort I can C-STORE the image in JPEG-LS format, but is there any built-in option to make Orthanc store the image in JPEG-LS?

There’s a new option “IngestTranscoding”: https://hg.orthanc-server.com/orthanc/file/Orthanc-1.7.2/OrthancServer/Resources/Configuration.json#l570

Note that JPEG-LS will also be slower than JPEG (1.2.840.10008.1.2.4.70)

FYI, here’s a speed comparison we’ve recently performed:

MR study of 3x3 instances

J2K | RAW | JPEGLS | JPEG |

  • | - | - | - | - | - |

orthanc-instance-cache:8042 | Size in MB | 1.240 | 4.527 | 1.253 | 1.674 |


| | | | |
Avg time for HQ image [s] | 0.237 | 0.116 | 0.135 | 0.025 |

| | | | |

CR study of 3x3 instances

Awesome.
“IngestTranscoding” : “1.2.840.10008.1.2.4.70” is precisely what I was looking for.

God Bless!

Hello,

Just a complement of information on this topic:

No, the JPEG2000 files need to be decompressed and re-compressed to JPG before the browser can decompress them. JPEG2000 decompression is very slow so it’s really not an optimal performance. RAW files are encoded into JPEG or PNG before being sent to the browser to reduce the bandwidth but PNG compression is very slow.

Is that JPEG/PNG compression lossy or lossless?
Is there an option to disable PNG since compression is slow?

JPEG is lossy (destructive compression).

PNG is lossless (non-destructive compression).

To replace the default PNG by JPEG when rendering images using the REST API of Orthanc, you can use the “Accept” HTTP header. For instance:

$ curl https://demo.orthanc-server.com/instances/246b7d7d-38f0e4f9-51961af5-cfa80371-a328935a/preview

=> PNG image
$ curl https://demo.orthanc-server.com/instances/246b7d7d-38f0e4f9-51961af5-cfa80371-a328935a/preview -H ‘Accept: image/jpeg’
=> JPEG image

Sébastien-