Add wasm jpegls and j2k/htj2k support #910
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR enables WASM builds of dcm2niix that have support for both jpegls and j2k/htj2k using an emscripten build of openjpeg.
An environment manager pixi, has been added to support the WASM build workflow across platforms (macOS/Linux). Note that on macOS-arm64 emscripten must still be installed/managed outside of pixi. Use a tool like homebrew to install it.
Here's the dcm2niix version string, printed to the browser console, where it reports the compiled jpeg support:
The WASM output files with jpeg support are roughly 1.8x the size of the base dcm2niix WASM build (a difference of 397K)
This size increase seems to track well with other browser implementations such as
@cornerstonejs/codec-openjpeg
which only compiles openjpeg (not combined with something like dcm2niix) and its size is 367 kBI have also tested the jpeg build of dcm2niix WASM in the browser using the
Aliza-DICOM-viewer-HTJ2k/HTJ2K-YBR_ICT.dcm
test image that was tested in issue #897. The resulting NIFTI file renders in niivue the same as Slicer3D:To test this PR locally
You will need:
Pixi is used to create the environment for building the WASM port of
dcm2niix
. To install pixi, follow their instructions.Building dcm2niix WASM
# from repo root pixi run wasm
clean up after build
# from repo root pixi run clean