Take the IMPACT backend from ITKIMPACT - #1463
Open
vboussot wants to merge 1 commit into
Open
Conversation
thewtex
approved these changes
Aug 11, 2026
vboussot
force-pushed
the
refactor-itkimpact-backend
branch
6 times, most recently
from
August 11, 2026 18:15
3cd2fee to
b58ebf7
Compare
The IMPACT losses, ModelConfiguration, online (Jacobian) inference, the vector-image interpolator and the Static feature-map generation come from the ITKIMPACT remote module, a one-way dependency Elastix to ITKIMPACT. The local copies (ImpactLoss.h, ImpactTensorUtils.*, itkBSplineInterpolateVectorImageFunction.*, itkImpactModelConfiguration.h) are removed, and the backend's ModelConfiguration source is compiled into the Impact component so its torch-free public header stays Python-wrappable. With USE_ImpactMetric ON, ITKIMPACT_INCLUDE_DIR must point at the ITKIMPACT include/ directory; both the ImpactMetric component and CommonGTest receive it, so elxImpactMetricGTest.cxx resolves the backend headers. ImpactWriteFeatureMaps becomes ImpactFeatureMapOutputDirectory. The patch geometry follows the backend's. PatchPoint() sends each offset through the fixed image's direction matrix, one column per image axis, and the sampling callbacks receive the patch tensor shape from itk::Impact::PatchTensorShape(). This is the index-to-physical map ITKIMPACT applies in its v4 threader and in ImageToTensorFilter, so both modes describe the same neighbourhood. CI provisions LibTorch with `pip install torch`, the same mechanism the backend uses, on every runner that has a wheel: all three on GitHub Actions, and Windows and Ubuntu on Azure. Azure's hosted macOS agents are Intel and PyTorch publishes no macOS x86_64 wheel past 2.2.2, so that one job builds LibTorch from source, at the v2.11.0 tag so all three platforms compile against the same headers. On Windows the steps that run elastix set PATH from cmd, whose entry separator is the one the loader expects, so the LibTorch DLLs are found next to the plugin. torch 2.11 is pinned rather than 2.12 because it is the last series still shipping CUDA cu128, the widest GPU coverage for the release: Blackwell plus older cards, driver floor R570, where 2.12 offers only cu126/cu129/cu130. The download_libtorch / build_libtorch actions are no longer referenced. The three Static baselines are regenerated against this configuration, and the suite is 8/8 on this branch.
vboussot
force-pushed
the
refactor-itkimpact-backend
branch
from
August 12, 2026 09:56
b58ebf7 to
de9f456
Compare
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.
The IMPACT losses,
ModelConfiguration, online (Jacobian) inference, the vector-image interpolator and the Static feature-map generation come from the ITKIMPACT remote module, a one-way dependency Elastix to ITKIMPACT. The local copies (ImpactLoss.h,ImpactTensorUtils.*,itkBSplineInterpolateVectorImageFunction.*,itkImpactModelConfiguration.h) are removed, and the backend'sModelConfigurationsource is compiled into the Impact component so its torch-free public header stays Python-wrappable.Building. With
USE_ImpactMetricON,ITKIMPACT_INCLUDE_DIRmust point at the ITKIMPACTinclude/directory. Both theImpactMetriccomponent andCommonGTestreceive it, soelxImpactMetricGTest.cxxresolves the backend headers.ImpactWriteFeatureMapsbecomesImpactFeatureMapOutputDirectory.Patch geometry follows the backend's.
PatchPoint()sends each offset through the fixed image's direction matrix, one column per image axis, and the sampling callbacks receive the patch tensor shape fromitk::Impact::PatchTensorShape(). This is the index-to-physical map ITKIMPACT applies in its v4 threader and inImageToTensorFilter, so both modes describe the same neighbourhood.CI provisions LibTorch with
pip install torchon all three OSes, the same mechanism the backend uses. torch 2.11 is pinned rather than 2.12 because it is the last series still shipping CUDA cu128, the widest GPU coverage for the release: Blackwell plus older cards, driver floor R570, where 2.12 offers only cu126/cu129/cu130. Thedownload_libtorch/build_libtorchactions are no longer referenced, andpython-versionmoves to 3.11 for thepip step.