The source code for the paper "SAMmorph".
- Better using virtual environment to avoid conflicts. For example:
This demo is tested on Ubuntu 18.04 (Nvidia GPU required), but the training/testing code should be compatible with Windows as well.
conda create -n Segmet python=3.7 conda activate Segmet pip install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.html pip install -r requirments.txt
- Please check and set up the hyper-parameters in
./config/global_train_config.pyand./config/mpmrireg_train_config.py. Save your command line in a bash file, like those examples in./scripts/mpmrireg. - The source code can only use processed medical image data, the structure of the data files can be organized as follows:
|---./data/mureg_data/
|---train
|---mr_images
|---case000000.nii.gz
|---case000001.nii.gz
.
.
|---case000064.nii.gz
|---mr_labels
|---...(structure same as above)
|---us_images
|---...(structure same as above)
|---us_labels
|---...(structure same as above)
|---val
|---...(structure same as above)
|---test
|---test_01.nii.gz
|---test_02.nii.gz
.
.
|---test_16.nii.gz
|---SegData
|---mr_labels
|---case000007.nii.gz
|---case000008.nii.gz
.
.
|---case000072.nii.gz
|---test_01.nii.gz
|---test_02.nii.gz
.
.
|---test_16.nii.gz
|---us_labels
|---...(structure same as above)
(If you use methods other than method Segmet, then the SegData folder is not necessary.)
- use following commandlines to repeat the experients in the paper
sh ./scripts/mpmrireg/[any of the bash file in it]
Modify the method_math in the test.exe file to conduct testing on the trained model. Run the following:
python test.py
Reference source for code section:
'voxelmorph', 'localnet', 'transmorph', 'MIDIR', 'CoTr', 'nnFormer',
'PVTVNet', 'ViTVNet', 'mamba', 'CorrMLP', 'mpmrireg'
- Please be free to create issues in this repo and to let me know if there're any problems. Thanks!