StrongResearch / dimble

Nimble Digital Imaging IO for Medicine
BSD 3-Clause "New" or "Revised" License
7 stars 2 forks source link

Conversion back to DICOM to support more dtypes and compression schemes. #3

Open StrongChris opened 1 year ago

StrongChris commented 1 year ago

Only 16bit RLELossless is supported currently. Ideally support as much as pydicom.

sluijs commented 1 year ago

This would be great to have indeed. Getting rid of pydicom as a dependency is one of Voxel's priorities as well. Here's a list of compression schemes/transfer syntax UIDs: https://www.dicomlibrary.com/dicom/transfer-syntax/.

In practice, JPEG2000 is the most commonly used transfer syntax for lossless compression, followed by regular JPEG for lossy compression. As mentioned in the email thread, NVIDIA has GPU-accelerated libraries for both of these. Currently, there doesn't seem to be a native Rust JPEG2000 decoder (been waiting for a long time for this...).

StrongChris commented 1 year ago

Interesting that you are looking to move away from pydicom? Can I ask why that is? Would you rather depend on another DICOM implementation or are you looking to implement the standard yourself?

One of my main goals was to leverage existing implementations of the DICOM standard to avoid needing to implement it ourselves. That's why pydicom is used to convert to/from JSON which is used as a kind of Intermediate Representation for converting to/from dimble.

sluijs commented 1 year ago

Pydicom uses dictionary lookup for tags and is pretty slow. It's a good starting point, but ultimately it'll become a bottleneck. Lazy DICOM loading is nicer or even streaming-based approaches. I've been using DICOM+JSON as well, but it's not 100% compatible with the original DICOM headers plus it would probably be easier to go from the original (binary) VR to a binary equivalent in msgpack or something similar.