π§ TorchScript Models for the IMPACT Semantic Similarity Metric
This repository provides a collection of TorchScript-exported pretrained models designed for use with the IMPACT similarity metric, enabling semantic medical image registration through feature-level comparison.
The IMPACT metric is introduced in the following preprint, currently under review:
IMPACT: A Generic Semantic Loss for Multimodal Medical Image Registration
V. Boussot, C. HΓ©mon, J.-C. Nunes, J. Dowling, S. RouzΓ©, C. Lafond, A. Barateau, J.-L. Dillenseger
arXiv:2503.24121 [cs.CV]
π§ The full implementation of IMPACT, along with its integration into the Elastix framework, is available in the repository:
β‘οΈ github.com/vboussot/ImpactLoss
This repository also includes example parameter maps, TorchScript model handling utilities, and a ready-to-use Docker environment for quick experimentation and reproducibility.
Anatomix variants
Two exports of the anatomix encoders:
| File | Network | Feature channels | Input size |
|---|---|---|---|
Anatomix/Anatomix.pt |
U-Net, 4 levels (anatomix.pth) |
16 | any (multiple of 16 per axis) |
Anatomix/AnatomixDevViT.pt |
PrimusV2 ViT, 27.1 M parameters (anatomix-dev-vit.pth) |
32 | 128 x 128 x 128 only |
The ViT's positional embedding is sized for a 128-voxel cube, so it has to be scored patch by patch at
that size: PatchSize 128 128 128 for Elastix, feature_patch: 128 for the KonfAI FireANTs engine.
Both are traced with their network in evaluation mode, so their normalisation layers use the learnt
statistics, and wrapped in a scripted module, so nb_layers, stats and direction keep their default
values and a caller may pass only the image. Anatomix.pt was previously traced with the network in
training mode, where its BatchNorms read each batch's own statistics: its features spanned roughly
+-109 against +-5 now, and the two correlate at 0.21 on random input. Pin the revision before
2026-09-23 to reproduce a result obtained with it:
ImpactModelConfiguration("VBoussot/impact-torchscript-models:Anatomix/Anatomix.pt", revision="<sha>")
Dino/DinoV2_Small.pt is exported the same way, for the same reason: traced with an empty stats
argument, its normalisation branch was frozen on the image's own min and max, so the statistics IMPACT
passes were ignored. Scored with statistics, the two exports differ by about 7e-3; without them they
agree to 9e-6.
NOTICE names, for every model here, where its weights come from and under which terms, and
LICENSES/ carries those licenses in full. Two of them bound what may be added to this repository:
TotalSegmentator publishes part of its tasks under Apache 2.0 and the rest behind a license number, of
which only the open ones are exported here; and DINOv3's checkpoints are covered by the DINOv3 License
Agreement, so they are built locally rather than redistributed.
The export scripts live in ImpactLoss/Data/Models/builds/Anatomix.
IMPACT-Seg
Three exports of the IMPACT-Seg networks, one segmentation network for CT, CBCT and MR, taken from its KonfAI apps, HCedric/IMPACTSeg:
| File | Network | Layers: channels / stride | Trained at |
|---|---|---|---|
ImpactSeg/Fine3D.pt |
fine-3d, fold 1: 3D residual-encoder U-Net |
32/1, 64/2, 128/4, 256/8, 320/16, 512/32, decoder 32/1, head 132/1 | 1.5 x 1.5 x 2 mm |
ImpactSeg/Fine2.5D.pt |
fine-2.5d, fold 1: 2D network on 5 adjacent axial slices |
the same, strided in-plane only | 1.5 x 1.5 x 2 mm |
ImpactSeg/Coarse.pt |
coarse: 3D residual-encoder U-Net |
16/1, 32/2, 64/4, 128/8, 192/16, decoder 16/1, head 12/1 | 3 mm |
As the TS models do, each returns its encoder stages, the last decoder block, then the one-hot of the label the app
gives each voxel. It standardizes its input from stats (mean and std) and reorients it onto RAS from direction,
as the apps do. It takes any input size, as the TS models do: an odd side halves rounding up and each decoder step
is cut back to its skip, so a side that divides by 32 (16 for Coarse) runs exactly as in the app. The two 3-D
models take norms, as the TS models do; without them, their deepest stage needs one side longer than 32 voxels
(16), or it holds a single voxel to normalise.
Fine2.5D.pt is a 3-D model to IMPACT. It takes a volume [B, 1, Z, Y, X], feeds each axial slice with its two
neighbours on either side as the app reads them (reflected past the first and the last slice), and returns its
layers as volumes, downsampled in-plane only. Its BatchNorms use their learnt statistics, so it has no norms.
On the app's own patches of a real CT and MR, every layer equals the app's network output voxel for voxel, and the
head equals the app's labels. The networks were trained at the resolution above: a preset that resamples the images
to it (voxel_size) feeds them what they were trained on.
NOTICE gives the source and terms of the weights. The export script lives in
ImpactLoss/Data/Models/builds/ImpactSeg.
π Pretrained Model
The TorchScript models provided in this repository were exported from publicly available pretrained networks. These include:
- TotalSegmentator (TS) β U-Net models trained for full-body anatomical segmentation
- MRSegmentator (MRSeg) β U-Net models trained for full-body anatomical segmentation in MRI and CT
- Segment Anything 2.1 (SAM2.1) β Foundation model for segmentation on natural images
- DINOv2 β Self-supervised vision transformer trained on diverse datasets
- Anatomix β Transformer-based model with anatomical priors for medical images
- IMPACT-Seg β residual-encoder U-Nets trained for anatomical segmentation on CT, CBCT and MR
Each model provides multiple feature extraction layers. This can be configured through the LayerMask parameter in the IMPACT configuration.
In addition, the repository also includes:
- MIND β A handcrafted descriptor, wrapped in TorchScript
| Model | Specialization | Paper / Reference | Field of View | License | Preprocessing |
|---|---|---|---|---|---|
| MIND | Handcrafted descriptor | Heinrich et al., 2012 | 2*r*d + 1 (r: radius, d: dilation) |
Apache 2.0 | Normalize intensities to [0, 1] |
| SAM2.1 | General segmentation (natural images) | Ravi et al., 2023 | 29 | Apache 2.0 | Normalize intensities to [0, 1], then standardize with mean 0.485 and std 0.229 |
| TS Models | CT/MRI segmentation | Wasserthal et al., 2022 | 2^l + 3 (l: layer number) |
Apache 2.0 (open tasks only, see NOTICE) |
Canonical orientation for all models. For MRI models (e.g., TS/M730βM733-M850βM853), standardize intensities to zero mean and unit variance. For CT models (e.g., TS/M258, TS/M291), clip intensities + normalize model dependant |
| MRSegmentator | CT/MRI segmentation | HΓ€ntze et al., 2024 | 2^l + 3 (l: layer number) |
Apache 2.0 | Standardize intensities to zero mean and unit variance. |
| IMPACT-Seg | CT/CBCT/MR segmentation | IMPACT-Seg (paper in preparation) | per layer, in models.json |
Apache 2.0 (training data: see NOTICE) |
Canonical orientation, then standardize intensities to zero mean and unit variance |
| Anatomix | Anatomy-aware encoder (U-Net, 16 features) | Dey et al., 2024 | Global(Static mode) | MIT | Normalize intensities to [0, 1] |
| AnatomixDevViT | Anatomy-aware encoder (ViT, 32 features) | Dey et al., 2024 | 128 (fixed input) | MIT + Apache 2.0 | Normalize intensities to [0, 1] |
| DINOv2 | Self-supervised vision transformer | Oquab et al., 2023 | 14 | Apache 2.0 | Normalize intensities to [0, 1], then standardize with mean 0.485 and std 0.229 |