Skip to content
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

Open
dazzag24 opened this issue Dec 9, 2024 · 7 comments
Open

Feature request: Add support for High-Throughput JPEG 2000 #897

dazzag24 opened this issue Dec 9, 2024 · 7 comments

Comments

@dazzag24
Copy link

dazzag24 commented Dec 9, 2024

The HTJ2K codec is an order of magnitude faster than JPEG2000, and at least twice as fast as all other DICOM transfer syntaxes. With HealthImaging, applications can leverage HTJ2K with single instruction multiple data (SIMD) instructions, for exceptional image decoding performance. Further, modern browsers can utilize Web Assembly SIMD (WASM-SIMD) to bring industry leading performance to zero-footprint web viewers.

ref: https://aws.amazon.com/blogs/industries/introducing-aws-healthimaging/

HTJ2K is the abbreviation for High-Throughput JPEG 2000, which is defined in Part 15 of the JPEG2000 standard (ISO/IEC 15444-15:2019). HTJ2K retains the advanced features of JPEG2000 such as resolution scalability, precincts, tiling, high bit depth, multiple channels, and color space support.

During import, AWS HealthImaging encodes all image frames in HTJ2K lossless format to deliver consistently fast image display and universal access to HTJ2K’s advanced features. Depending on your programming language, we recommend the following decoding libraries for image frames (pixel data).

OpenJPH

OpenJPEG

openjphpy

pylibjpeg-openjpeg

Kakadu Software

ref: https://docs.aws.amazon.com/healthimaging/latest/devguide/reference-htj2k.html

Is this something that could make sense for dcm2niix to support?

Thanks

@neurolabusc
Copy link
Collaborator

@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.

@dazzag24
Copy link
Author

dazzag24 commented Dec 10, 2024

Does dcm2niix need to be made aware of the new transport syntaxes? Looks that way.

❯  ./dcm2niix -v
Chris Rorden's dcm2niiX version v1.0.20241208  (JP2:OpenJPEG) (JP-LS:CharLS) Clang12.0.0 ARM (64-bit MacOS)
v1.0.20241208

❯ ./dcm2niix -o ~/Downloads/converted_decomps5 -z y -f %j_%k ~/Desktop/converted_decomps5
Chris Rorden's dcm2niiX version v1.0.20241208  (JP2:OpenJPEG) (JP-LS:CharLS) Clang12.0.0 ARM (64-bit MacOS)
Found 473 DICOM file(s)
Warning: Unsupported transfer syntax '1.2.840.10008.1.2.4.201' (see www.nitrc.org/plugins/mwiki/index.php/dcm2nii:MainPage)
Warning: Unsupported transfer syntax '1.2.840.10008.1.2.4.201' (see www.nitrc.org/plugins/mwiki/index.php/dcm2nii:MainPage)
Warning: Unsupported transfer syntax '1.2.840.10008.1.2.4.201' (see www.nitrc.org/plugins/mwiki/index.php/dcm2nii:MainPage)

I downloaded the most recent version: https://github.com/rordenlab/dcm2niix/releases

@neurolabusc
Copy link
Collaborator

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.

@dazzag24
Copy link
Author

There are a couple of examples here:
https://github.com/pydicom/pydicom-data/tree/master/data_store/data
see the files beginning "HTJ2K*" which have the following transfer syntaxes

1.2.840.10008.1.2.4.201
1.2.840.10008.1.2.4.203

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.

@dazzag24
Copy link
Author

Hi, Did you receive the example series that I emailed?
Thanks

@dazzag24
Copy link
Author

dazzag24 commented Dec 12, 2024

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)"

@neurolabusc
Copy link
Collaborator

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants