This is the official Pytorch implementation of "Large Deformation Diffeomorphic Image Registration with Laplacian Pyramid Networks" (MICCAI 2020), written by Tony C. W. Mok and Albert C. S. Chung.
** Please also check out our new conditional deformable image registration framework (c-LapIRN - MICCAI2021) at https://github.com/cwmok/Conditional_LapIRN, which enables precise control on the smoothness of the deformation field and rapid hyperparameter tuning. **
Python 3.5.2+
Pytorch 1.3.0 - 1.7.0
NumPy
NiBabel
This code has been tested with Pytorch 1.3.0
and GTX1080TI GPU.
If you prefer diffeomorphic solutions, please try:
python Test_LapIRN_diff.py
If you prefer solutions with maximized registration accuracy, please try:
python Test_LapIRN_disp.py
Step 1: Replace /PATH/TO/YOUR/DATA
with the path of your training data. You may also need to implement your own data generator (Dataset_epoch
in Functions.py
).
Step 2: Change the imgshape
variable (in Train_LapIRN_diff.py
or Train_LapIRN_disp.py
) to match the resolution of your data.
(Optional) Step 3: You may adjust the size of the model by manipulating the argument --start_channel
.
Step 3: python Train_LapIRN_diff.py
to train the LapIRN formulated with the stationary velocity field, or python Train_LapIRN_disp.py
to train the LapIRN formulated with the displacement field.
If you want to train on the preprocessed OASIS dataset in https://github.com/adalca/medical-datasets/blob/master/neurite-oasis.md. We have an example showing how to train on this dataset.
- Download the preprocessed OASIS dataset, unzip it and put it in "Data/OASIS".
- To train a new LapIRN model,
python Train_LapIRN_diff_resize.py
will create a LapIRN model trained on all cases (with images resized to (144, 160, 192) resolution) in the dataset. - To test the model,
python Test_LapIRN_diff_resize.py --modelpath {{pretrained_model_path}} --fixed ../Data/image_A_fullsize.nii.gz --moving ../Data/image_B_fullsize.nii.gz
will load the assigned model and register the image "image_A_fullsize.nii.gz" and "image_B_fullsize.nii.gz".
Note that the LapIRN model in Train_LapIRN_diff_resize.py
is trained with downsampled images with size indicated in the variable imgshape
. Feel free to adjust the image size by adjusting the variable imgshape
in Train_LapIRN_diff_resize.py
.
If you find this repository useful, please cite:
- Large Deformation Diffeomorphic Image Registration with Laplacian Pyramid Networks
Tony C. W. Mok, Albert C. S. Chung
MICCAI 2020. eprint arXiv:2006.16148
We changed the regularization term in the loss function. The original regularization term is computed on the normalized velocity/displacement field, which may cause bias to the short axis.
Some codes in this repository are modified from IC-Net and VoxelMorph.
Keywords: Diffeomorphic Image Registration, Large Deformation, Laplacian Pyramid Networks, Convolutional neural networks