-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Add support for High-Throughput JPEG 2000 #897
Comments
@dazzag24 dcm2niix uses OpenJPEG to decode jpeg2000, and OpenJPEG is one of the decoding libraries that supports HTJ2K. Therefore, you should have this support if you compile dcm2niix with OpenJPEG 2.5.0 or later. |
Does dcm2niix need to be made aware of the new transport syntaxes? Looks that way.
I downloaded the most recent version: https://github.com/rordenlab/dcm2niix/releases |
I am unable to replicate. Can you share a sample of this transfer syntax with my institutional email, or describe how a DICOM image can be converted to this transfer syntax. It does not seem like gdcmconv 3.0.24 that uses OpenJPEG 2.5.3 supports this yet. |
There are a couple of examples here: 1.2.840.10008.1.2.4.201 See https://github.com/pydicom/pydicom/blob/153a3a9afeb35165ff175ebfbe21eca1a93014fc/src/pydicom/uid.py#L335 for a mapping to the human readable name. I can send you a full series that uses 1.2.840.10008.1.2.4.201 but its a 140Mb zip so possibly to large to email. |
Hi, Did you receive the example series that I emailed? |
I became aware of another set of example image today that are being used by the ITK team See https://www.aliza-dicom-viewer.com/download/datasets and the link to "Color files, 1920 x 1080 px (update 2024.01.08, added HTJ2K)" |
@dazzag24 why don't you try out the latest commit to the development branch (v1.0.20241211). You have to compile with the OpenJPEG. The easiest way to do this is with the cmake superbuild: git clone --branch development https://github.com/rordenlab/dcm2niix.git
cd dcm2niix
mkdir build && cd build
cmake -DZLIB_IMPLEMENTATION=Cloudflare -DUSE_JPEGLS=ON -DUSE_OPENJPEG=ON ..
make I also added a faster way to build, but you will have to tune the /console/makefile to match the location of your JPEG2000 library: git clone --branch development https://github.com/rordenlab/dcm2niix.git
cd dcm2niix\console
make jp2 |
Hi, Apologies for the delay. I finally got around to doing some testing on this. As you know I found an issue with the converted NIfTI files being much smaller but wanted to be sure that it was not a problem with how my DICOM compression code was producing the HTJ2K DICOMs I was using in testing. I am now confident that this not the case. Using the test files from Aliza (see above) and from pydicom I also see issues where the output NIfTI file is corrupt. Using the HTJ2KLossless_08_RGB.dcm file from the pydicom test data
The resulting NIfTI looks like this in 3D Slicer: Also with HTJ2K-YBR_ICT.dcm file from the pydicom test data
The resulting NIfTI looks like this in 3D Slicer: NIfTIs from my own test dataset I see output like this: I'm fairly confident that my HTJ2K DICOMs are valid as I have code that compares the pixel array from the original DICOMs with the decompressed pixel arrays and they seem valid (e,g I have test code that takes an original DICOM, compresses it and then opens the compressed file using pydicom accesses the pixel_array object). Furthermore my HTJ2K compressed DICOMs are correctly rendered in both Please let me know if you want anymore info. Thanks |
@dazzag24 you are correct, the current dcm2niix cmake uses OpenJPEG 2.1 while high throughput (HTJ2K) decoding requires OpenJPEG 2.5.0 or later. You can use the @ningfei would it be possible to update your cmake library for the latest stable OpenJPEG? |
will have a look when I find the time. |
For now I have added some extra steps to my Dockerfile that downloads and compiles Thanks |
Quick question. I normally compile with By using |
I have added a commit to the development branch that provides arguments to
With regards to creating compressed NIfTIs, dcm2niix can be compiled to use one of 3 internal compressors: miniz (slightly slower than zlib), system zlib, or cloudflare zlib (about twice as quick as zlib). The |
The latest commit introduces the option to use the system zlib during compilation with To compile with the system zlib, use the following command: JPEGLS=1 ZLIB=1 make jp2 |
Thanks, I was already using |
@dazzag24 note that while both the arguments So the options are:
If you run dcm2niix without any arguments, the help file will tell you if it was compiled with miniz or zlib as an internal compressor. HOwever, it does not distringuish between the system zlib and cloudflare zlib as they are both zlib compatible libraries.
|
Thanks for the detailed explanation. Would be great to add this to some
docs. I don't think the current README.md goes into that level of detail?
…On Tue, 31 Dec 2024 at 18:07, Chris Rorden ***@***.***> wrote:
@dazzag24 <https://github.com/dazzag24> note that while both the
arguments -z y and -z o can use pigz to accelerate compression, they are
slightly different. The -z y will write each NIfTI file to disk
uncompressed and then compress the file, analogous to running the command pigz
--no-time -n -f -6 /path/to/image.nii'. On the other hand, using -z o on
a Unix computer will pipe the raw data directly to pigz, without creating
the intermediate uncompressed file. This piped operation requires you have
pigz 2.3.4 (released Oct 2, 2016) or later. The difference is negligible
for fast local SSD storage, but can be substantial if you are saving NIfTI
images to networked storage.
So the options are:
argument notes
-z n create uncompressed NIfTIs
-z y use pigz if found (intermediate file), else use internal compressor
-z o use pigz if found (piped data), else use internal compressor
-z i use internal compressor
If you run dcm2niix without any arguments, the help file will tell you if
it was compiled with miniz or zlib as an internal compressor. HOwever, it
does not distringuish between the system zlib and cloudflare zlib as they
are both zlib compatible libraries.
-z : gz compress images (y/o/i/n/3, default n) [y=pigz, o=optimal pigz, i=internal:zlib, n=no, 3=no,3D]
-z : gz compress images (y/o/i/n/3, default n) [y=pigz, o=optimal pigz, i=internal:miniz, n=no, 3=no,3D]
—
Reply to this email directly, view it on GitHub
<#897 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIBYV4KNBZXP6I5OCH5V2D2ILMPHAVCNFSM6AAAAABTI4V6NWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNRWGYZTGNBZGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
ref: https://aws.amazon.com/blogs/industries/introducing-aws-healthimaging/
ref: https://docs.aws.amazon.com/healthimaging/latest/devguide/reference-htj2k.html
Is this something that could make sense for dcm2niix to support?
Thanks
The text was updated successfully, but these errors were encountered: