Repository navigation
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
…_bridge The ITK-MONAI affine bridge now ships with MONAI as monai.data.itk_torch_bridge, so use it instead of the unpublished itk_torch_affine_matrix_bridge module, and register the 3D lung CT images in examples/data instead of the missing real_*.nii.gz files. The fixed and moving lung images differ in size, and as of MONAI 1.6 itk_to_monai_affine(reference_image=...) takes both grid centers from the reference image size. Compose the fixed-to-moving grid mapping from get_itk_image_center instead, which matches the reference_image path for equally sized images and reproduces the Elastix result within float32 precision here. Convert the MONAI output back with metatensor_to_itk_image and assert the voxel match, so the nbmake CI job checks the bridge. Number the notebook 27, the next free example number. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
3 of 5 tasks
thewtex
force-pushed
the
notebook_monai_bridge
branch
from
October 12, 2026 16:57
fcc4c84 to
848596a
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Includes an example of Elastix-MONAI affine bridge that was removed from InsightSoftwareConsortium/itk-torch-transform-bridge#6.
It will be updated/repurposed when Project-MONAI/MONAI#5897 is merged into MONAI.
Also related to: #126
Update
Project-MONAI/MONAI#5897 was merged in February 2023, and the ITK-MONAI affine bridge now ships with MONAI as
monai.data.itk_torch_bridge. The notebook is rewritten to use it and renumbered toexamples/ITK_Example27_Elastix_affine_MONAI_resample.ipynb, rebased on currentmain. The original commit is kept.examples/datawith an Elastix affine transform. That pair has different sizes and origins and anisotropic spacing. The previousreal_*.nii.gzfiles were never added to the repository.itk_to_monai_affineconverts the Elastix parameters, and MONAI'sAffineresamples the moving image onto the fixed image grid.metatensor_to_itk_imageconverts the result back to ITK.itk_to_monai_affine(reference_image=...)gives a wrong affine when the two images differ in size. The notebook composes the fixed-to-moving grid mapping fromget_itk_image_centerinstead. The upstream fix is Fix itk_to_monai_affine reference_image for images of different sizes Project-MONAI/MONAI#9158; once it is released, the notebook can passreference_image=fixed_imagedirectly.🤖 Generated with Claude Code