This Docker environment builds a version of Elastix with support for the IMPACT similarity metric.
From the root of the repository:
docker build -t elastix_impact docker/To execute a registration:
docker run --rm --gpus all \
-v "./Data:/Data" \
-v "./Out:/Out" \
elastix_impactThe container expects the following files inside the Data/ directory:
-
Data/Models/
Must contain the TorchScript-exported models used by the IMPACT metric (e.g., TotalSegmentator, SAM2.1, etc.).
👉 SeeData/Models/README.mdfor model download instructions. -
Data/Fixed_image.mhaandData/Moving_image.mhaThe images used for registration. These files can be provided in either .mha or .nii.gz format. -
Data/ParameterMap.txt
Elastix parameter file with the configuration for Impact.
👉 SeeParameterMaps/README.mdfor detailed configuration examples.
Optional files (for mask-based registration or evaluation):
Data/Fixed_mask.mhaandData/Moving_mask.mha— binary masks to restrict metric computation.Data/Fixed_landmarks.txtandData/Moving_landmarks.txt— optional landmarks for TRE evaluation.
Output results (transforms, logs) will be written to the mounted Out/ directory.
To see a complete example of how to run a registration using this Docker setup, check:
👉 Docker/run_docker_impact_example.py
If you have a compatible GPU and the necessary toolkit (e.g., NVIDIA Docker support), it will be available inside the Docker container. You can select which GPU to use by setting the GPU parameter in the ParameterMap file ((GPU 0), (GPU 1), or (GPU -1) to disable GPU usage). This enables the registration process to run on the GPU, significantly speeding up computation.
Without GPU / No Toolkit: If you don't have a GPU or the required toolkit, simply remove the --gpus all flag from the command. In this case, set (GPU -1) in the Elastix parameter map to disable GPU usage and run the process on the CPU.