-
Notifications
You must be signed in to change notification settings - Fork 280
Add ImpactReg extension #2264
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
base: main
Are you sure you want to change the base?
Add ImpactReg extension #2264
Conversation
419bf92 to
658bbe8
Compare
658bbe8 to
298744a
Compare
|
Thanks for your contribution! As I see, a custom build of Elastix binaries is downloaded from somewhere, but I could not easily find from where and how. Could you please clarify? |
|
FYI, on Windows I get this error when I try to run the registration: |
|
The custom elastix binaries are simply a compilation of elastix with the IMPACT similarity metric enabled. IMPACT relies on LibTorch at runtime to extract deep features. For this reason, multiple pre-built elastix binaries are provided (CPU-only and CUDA-enabled). This script automatically selects the appropriate build, downloads it, and (if needed) fetches the matching LibTorch version and ensures it is correctly linked at runtime, so that elastix works out of the box. |
|
This return code usually indicates a missing runtime DLL. dumpbin /DEPENDENTS elastix.exe This should help identify which runtime dependency is missing. |
|
On Windows (with Slicer-5.10), the custom-built Elastix packages are not self-contained - several pytorch DLLs are missing (even from the CPU package, such as fbgemm.dll). They work if I copy (and overwrite all existing DLLs) from "...\AppData\Local\slicer.org\3D Slicer 5.10.0\lib\Python\Lib\site-packages\torch\lib" to FYI, on an RTX3060, registering MRBrainTumor1 to MRBrainTumor1 is really slow (it is at 35% after about 30 minutes). This is a problem, because Elastix basic bpsline takes <1min on CPU and it usually gives acceptable results. |
|
When I attempt to run elastix.exe from elastix-impact-windows-x86_64-shared-with-deps-cpu.zip, I get errors about missing fbgemm.dll and libiomp5md.dll. |
|
Thank you, indeed, the issue comes from the fact that the custom Elastix packages were not truly self-contained for the CPU version. In the initial packaging, I performed an overly aggressive pruning of PyTorch runtime libraries, assuming that some components (such as fbgemm.dll, libiomp5md.dll, etc.) were not required at runtime based on my local tests. Clearly, this assumption does not hold across all Windows environments. I have since revised this approach: No LibTorch libraries are shipped anymore with the custom Elastix binaries, for both CPU and CUDA builds. The installation script now downloads the Impact release and the appropriate official LibTorch distribution (CPU or CUDA). It then explicitly copies the required runtime libraries into a directory visible to the elastix binary. Regarding the possibility of reusing PyTorch libraries installed through the PyTorch utils extension, unfortunately this installation is not under my control (exact version, CUDA runtime version). However, the Elastix/IMPACT binary requires a very specific LibTorch version (LibTorch 2.8.0, with or without CUDA 12.8). As a result, while reusing torch/lib from a pip installation may avoid missing library errors, it can introduce ABI incompatibilities between the LibTorch version used at build time and the one loaded at runtime, leading to symbol resolution errors. |
|
At the moment, the configuration you tested uses a heavy test preset of the IMPACT metric, which was intentionally designed for stress-testing and validation, not for efficiency on simple mono-modal cases such as MR→MR registration. This explains the very long runtime you observed. In practice, IMPACT is not intended to replace Elastix’s standard B-spline registration on simple MR→MR cases, where the classical pipeline is already fast and usually sufficient. I will add lighter, task-specific presets, in particular: optimized presets for CBCT↔CT registration, and with appropriate model choices, resolutions, and optimization settings. These presets will be much more representative of the intended use cases and will avoid unnecessary computational overhead. |
New extension
Tier 1
Any extension that is listed in the Extensions Catalog must fulfill these requirements.
Slicer(unless it explicitly provides a bridge between Slicer and a tool or library), because it would make it more difficult to find extensions if the name of many started with the same word.3d-slicer-extensionGitHub topic so that it is listed here. To edit topics, click the settings icon in the right side of "About" section header and enter3d-slicer-extensionin "Topics" and click "Save changes". To learn more about topics, read https://help.github.com/en/articles/about-topicsSettingsand in repository settings uncheckWiki,Projects, andDiscussions(if they are currently not used).Aboutin the top-right corner of the repository main page and uncheckReleasesandPackages(if they are currently not used)Tier 3
Community-supported extensions.
Tier 5
Critically important extensions, supported by Slicer core developers. New Slicer Stable Release is released only if all Tier 5 extension packages are successfully created on all supported platforms.
This PR adds IMPACT-Reg, a new extension enabling multimodal medical image registration directly inside 3D Slicer.
IMPACT-Reg integrates the IMPACT deep semantic similarity metric into the Elastix registration tools and exposes it through a user-friendly GUI.
Key functionality included
The module depends on the KonfAI extension, which provides KonfAI App execution support.