MIR Documentation
Overview
MIR is a research toolkit for medical image registration, providing model implementations, training/inference scripts, and supporting utilities. It also includes curated wrappers for selected external packages to support TransMorph‑style registration workflows.
Documentation: https://junyuchen.me/MIR
Repository: https://github.com/junyuchen245/MIR
Installation
Prerequisite: Install a CUDA-enabled PyTorch build before installing MIR.
Editable install (recommended):
git clone https://github.com/junyuchen245/MIR.git
cd MIR
python3.8 -m pip install -U pip
python3.8 -m pip install -e .
Platform notes
deedsBCV integration is Linux-only. Windows users can still use MIR, but deedsBCV functionality is unavailable.
Getting started
Quick start: IXI benchmarking
Benchmark multiple registration models on the IXI dataset using the scripts in tutorials/IXI_benchmarking.
cd tutorials/IXI_benchmarking
python3.8 -u train_TransMorph.py
python3.8 -u train_TransMorphTVF.py
python3.8 -u train_SITReg.py
python3.8 -u train_SITReg_SPR.py
Example: Brain template construction
Build a population template from LUMIR24 using TransMorphTVF, VFA, or ConvexAdam. See Brain template example for the full walkthrough.
Included Projects
Pretraining Deformable Image Registration Networks with Random Images Chen, Junyu, et al. *MIDL Short Papers*, 2025. Paper | Repo
Correlation Ratio for Unsupervised Learning of Multi-modal Deformable Registration Chen, Xiaojian, et al. *SPIE Medical Imaging: Image Processing*, 2025. Paper | Repo
Unsupervised Learning of Spatially Varying Regularization for Diffeomorphic Image Registration Chen, Junyu, et al. *Medical Image Analysis*, 2025. Paper | Repo
Vector Field Attention for Deformable Image Registration Liu, Yihao, et al. *Journal of Medical Imaging*, 2024. Paper | Repo
Unsupervised Learning of Multi-modal Affine Registration for PET/CT Chen, Junyu, et al. *IEEE NSS/MIC/RTSD*, 2024. Paper | Repo
On Finite Difference Jacobian Computation in Deformable Image Registration Liu, Yihao, et al. *International Journal of Computer Vision*, 2024. Paper | Repo
Deformable Cross-Attention Transformer for Medical Image Registration Chen, Junyu, et al. *MLMI Workshop*, MICCAI 2023. Paper | Repo
Unsupervised Learning of Diffeomorphic Image Registration via TransMorph Chen, Junyu, et al. *WBIR*, 2022. Paper | Repo
TransMorph: Transformer for Unsupervised Medical Image Registration Chen, Junyu, et al. *Medical Image Analysis*, 2022. Paper | Repo
External Wrappers Included
Intensity Normalization Toolkit Reinhold, Jacob C., et al. *SPIE MI*, 2019. Paper | Repo
ConvexAdam: Dual-Optimization-Based 3D Registration Siebert, Hanna, et al. *IEEE TMI*, 2024. Paper | Repo
MultiMorph: On-demand Atlas Construction Abulnaga, S. Mazdak, et al. *CVPR*, 2025. Paper | Repo
SITReg: Multi-resolution architecture for symmetric, inverse consistent, and topology preserving image registration. Honkamaa, Joel, and Pekka Marttinen. *MELBA*, 2024. Paper | Repo
deedsBCV Repo
About Me
Contents:
- Quick Start
- Brain registration (affine + deformable)
- IXI benchmarking quick start
- Brain template example
- Models
- API Reference
- MIR.models
- MIR.utils
- MIR.image_similarity
- MIR.deformation_regularizer
- MIR.accuracy_measures
AdvancedDecoder3DAffineReg3DAffineTransformerConv3dReLUConvNeXtSynthHead3DDecoderDecoderBlockDefSwinTransformerDefSwinTransformerV2DoubleConv3dEfficientAdvancedSynthHead3DGroupNet3DHyperTransMorphTVFHyperTransMorphTVFSPRHyperVFAHyperVFASPRHyperVxmDenseListBatchSamplerMeanStreamPreAffineToTemplateRegistrationHeadSSLHead1LvlSSLHeadNLvlSpatialTransformerSwinTransformerSynthesisHead3DSynthesisHead3DAdvancedTemplateCreationTransMorphTransMorphAffineTransMorphTVFTransMorphTVFSPRTransVFAVFAVFASPRVecIntVxmDenseWarp3dconvex_adam_MIND()convex_adam_MIND_SPR()convex_adam_features()convex_adam_seg_features()convex_adam_vfa()ensemble_average()fit_warp_to_svf()fit_warp_to_svf_fast()get_3DTransMorph3Lvl_config()get_3DTransMorphDWin3Lvl_config()get_3DTransMorphLarge_config()get_3DTransMorphLrn_config()get_3DTransMorphNoConvSkip_config()get_3DTransMorphNoRelativePosEmbd_config()get_3DTransMorphNoSkip_config()get_3DTransMorphNoTransSkip_config()get_3DTransMorphRelativePosEmbdSimple_config()get_3DTransMorphSin_config()get_3DTransMorphSmall_config()get_3DTransMorphTiny_config()get_3DTransMorph_config()get_ConvexAdam_MIND_brain_default_config()get_VFA_default_config()get_VXM_1_config()get_VXM_BJ_config()get_VXM_default_config()grid_to_flow()invert_warp_via_velocity()make_epoch_batches()AverageMeterLoggerMultiResPatchSampler3DRandomPatchSampler3DSLANT_label_reassign()SpatialTransformerVecIntget_cmap()load_partial_weights()make_affine_from_pixdim()mk_grid_img()pad_image()pkload()resample_to_orginal_space_and_save()savepkl()sliding_window_inference()write2csv()zoom_img()CompReconCorrRatioDiceLossDiceSegLossFastNCCLocalCorrRatioMIND_lossMutualInformationNCCNCC_fp16NCC_gaussNCC_mokNCC_mok2NCC_vfaNCC_vxmPCCSSIM2DSSIM3DSegmentationLosscreate_window()create_window_3D()gaussian()localMutualInformationssim()ssim3D()DisplacementRegularizerGrad2DGrad3DiTVGrad3dGradICON3dGradICONExact3dKL_divergenceLocalGrad3dMultiVariateKL_divergencelogBetalogGaussiancalc_J_i()calc_Jstar_1()calc_Jstar_2()calc_jac_dets()calc_measurements()dice_val_VOI()dice_val_all()dice_val_substruct()get_identity_grid()