Awesome
Learning Diffeomorphism for Image Registration with Time-Continuous Networks using Semigroup Regularization
This is the official repository of the SGDIR paper submitted to IEEE Transactions on Medical Imaging.
Installing the dependencies
This package is written in Python 3.10. To install the dependencies, run the following command
pip install -r requirements.txt
Datasets
You must specify the path to the dataset inside the config file associated to each dataset.
NOTE In writing the dataloader for the OASIS dataset we have assumed the data folder structure is as follows:
π¦OASIS
β£ πOASIS_OAS1_0001_MR1
β β£ πaligned_norm.nii.gz
β β πaligned_seg35.nii.gz
β£ πOASIS_OAS1_0002_MR1
β£ πOASIS_OAS1_0003_MR1
β£ πOASIS_OAS1_0004_MR1
β .
β .
β .
β πOASIS_OAS1_0457_MR1
Where each subject has the aligned_norm.nii.gz (for the MNI 152 1mm normalized image) and aligned_seg35.nii.gz (for the segmentation mask with 35 structures). If your file structure or file names are different, you might need to modify the load_image_pair method of OASISRegistrationV2 dataloader in data.py.
NOTE In writing the dataloader for the CANDI dataset we have assumed the data folder structure is as follows:
π¦CANDI
β£ πSchizBull_2008
β β£ πBPDwithPsy
β β β£ πBPDwPsy_065
β β β β£ πMNI152_2mm_Linear
β β β β β£ πBPDwPsy_065_affine_transf.mat
β β β β β£ πBPDwPsy_065_linear_MRI.nii.gz
β β β β β πBPDwPsy_065_linear_SEG.nii.gz
β β β£ πBPDwPsy_066
β β .
β β .
β β .
β β£ πBPDwithoutPsy
β β β£ πBPDwoPsy_030
β β β β£ πMNI152_2mm_Linear
β β β β β£ πBPDwoPsy_030_affine_transf.mat
β β β β β£ πBPDwoPsy_030_linear_MRI.nii.gz
β β β β β πBPDwoPsy_030_linear_SEG.nii.gz
β β β£ πBPDwoPsy_031
β β .
β β .
β β .
β β£ πHC
β β β£ πHC_001
β β β β£ πMNI152_2mm_Linear
β β β β β£ πHC_001_affine_transf.mat
β β β β β£ πHC_001_linear_MRI.nii.gz
β β β β β πHC_001_linear_SEG.nii.gz
β β β£ πHC_002
β β .
β β .
β β .
β β πSS
β β β£ πSS_084
β β β β£ πMNI152_2mm_Linear
β β β β β£ πSS_084_affine_transf.mat
β β β β β£ πSS_084_linear_MRI.nii.gz
β β β β β πSS_084_linear_SEG.nii.gz
β β β£ πSS_085
β β .
β β .
β β .
If your file structure or file names are different, you might need to modify the load_image_pair method of CANDIRegistrationV2 dataloader in data.py.
NOTE In writing the dataloader for the LPBA40 dataset we have assumed the data folder structure is as follows:
π¦LPBA40
β£ πDelineation
β β£ πS01
β β β£ πS01.delineation.skullstripped.img
β β β£ πS01.delineation.skullstripped.hdr
β β β£ πS01.delineation.structure.label.img
β β β πS01.delineation.structure.label.hdr
β β£ πS02
β β .
β β .
β β .
β β πS40
If your file structure or file names are different, you might need to modify the load_image_pair method of LPBA40Registration dataloader in data.py.
The training, validation, and test pair ids are stored in
π¦tmp
β£ πcandi_train_val_test.json
β£ πlpba_train_val_test.json
β πoasis_train_val_test.json
If such files do not exist already, the dataloaders inside the data.py will automatically create one. Otherwise, the already existing files are used to retrieve the training, validation, and test pairs.
For the showcase, the file consisting of a single same pair for training, validation, and test pair is included. Feel free to remove the file, and run the program to generate the pairs for the entire dataset, or manually change the file to include the pairs of your choice.
Training
- To train the model run the following:
python train.py -c oasis | candi | lpba
NOTE Running train or eval file wihtout the option -c sets the OASIS dataset as the default.
NOTE You can change some training/validation configurations and model architecture inside the OASIS config file, CANDI config file, and LPBA40 config file
Evaluation
- To evaluate the model run the following:
python eval.py -c oasis | candi | lpba