Welcome to the official code repository for the paper "fRegGAN: K-space Loss Regularization for Medical Image Translation". The repository is dedicated to enabling researchers and developers to reproduce the results presented in our paper.
The code present in this repository is maintained by the original authors of the paper and is open to contributions, fixes, and updates from the research community.
Please note, while the preprocessed data is available, the trained models are not part of this repository. The objective of this repository is to facilitate an understanding of our methodology and to allow the research community to reproduce and validate our results.
We sincerely hope that our work contributes to your research, development, and understanding of frequency-regularized generative adversarial networks. Happy coding!
@article{baltruschat2023freggan,
title={fRegGAN with K-space Loss Regularization for Medical Image Translation},
author={Ivo M. Baltruschat and Felix Kreis and Alexander Hoelscher and Melanie Dohmen and Matthias Lenga},
year={2023},
eprint={2303.15938},
archivePrefix={arXiv},
primaryClass={eess.IV}
}
-
Conda as environment manager. If not installed, you can download and install Mamba with the following command:
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh" && bash Mambaforge-$(uname)-$(uname -m).sh
-
Poetry as dependency and package manager. If not installed, you can download and install the preview version with:
curl -sSL https://install.python-poetry.org | python3 - --version 1.2.2
-
WandB as experiment tracking, data versioning. Using wandb requires you to setup an account first. After that just complete the config as below.
First we need to create a conda environment and install all needed packages. This can be done manually or automatically.\
conda env create -p "$PWD/.envs/cmrai_py39" --file "$PWD/docker-pytorch/environment.yml"
conda activate "$PWD/.envs/cmrai_py39"
poetry install --no-dev
export WANDB_USER=[YOUR_username]
export WANDB_KEY=[API_KEY]
export WANDB_ENTITY=[YOUR_ENTITY]
dump-env --source=.env.template > .env
We uploaded a preprocessed version of the BraTS2021 dataset to Zenodo here.
First, you need to download the data and then unzip the tar.gz file into the folder data
.
zenodo_get 8141526
tar -xzvf brats2021_nii.tar.gz -C "$PWD/data"
Then run the following commands to prepare the data.
python cmrai/data/prepare_brats.py
python cmrai/data/process_brats.py --data_dim=2d
python cmrai/data/splitdata_brats.py --data_dim=2d --do_cleaning
python cmrai/train.py experiment=paper_01_cycle_gan_00.yaml
This project was inspired by:
- ashleve/lightning-hydra-template
- PyTorchLightning/deep-learninig-project-template
- drivendata/cookiecutter-data-science
- lucmos/nn-template
- kedro-org/kedro
Useful repositories:
- pytorch/hydra-torch - safely configuring PyTorch classes with Hydra
- romesco/hydra-lightning - safely configuring PyTorch Lightning classes with Hydra
- PyTorchLightning/lightning-transformers - official Lightning Transformers repo built with Hydra
Other resources: