ai-med / quickNAT_pytorch

PyTorch Implementation of QuickNAT and Bayesian QuickNAT, a fast brain MRI segmentation framework with segmentation Quality control using structure-wise uncertainty
MIT License
101 stars 36 forks source link
ai bayesian biomarkers brain-imaging computer-vision convolutional-neural-networks deep-learning machine-learning medical-imaging mri-images neuroanatomy pytorch quality-control segmentation uncertainty

QuickNat and Bayesian QuickNAT - Pytorch implementation

A fully convolutional network for quick and accurate segmentation of neuroanatomy and Quality control of structure-wise segmentations

The code for training, as well as the Trained Models are provided here.

Deployment of existing off-the-shelf Model to segment any MRI scans is just by running RunFile.

Let us know if you face any problems running the code by posting in Issues.

If you use this code please cite the following papers:

@article{roy2019quicknat,
  title={QuickNAT: A fully convolutional network for quick and accurate segmentation of neuroanatomy},
  author={Roy, Abhijit Guha and Conjeti, Sailesh and Navab, Nassir and Wachinger, Christian and Alzheimer's Disease Neuroimaging Initiative and others},
  journal={NeuroImage},
  volume={186},
  pages={713--727},
  year={2019},
  publisher={Elsevier}
}

@article{roy2019bayesian,
  title={Bayesian QuickNAT: Model uncertainty in deep whole-brain segmentation for structure-wise quality control},
  author={Roy, Abhijit Guha and Conjeti, Sailesh and Navab, Nassir and Wachinger, Christian and Alzheimer's Disease Neuroimaging Initiative and others},
  journal={NeuroImage},
  volume={195},
  pages={11--22},
  year={2019},
  publisher={Elsevier}
}

Online demo for trying out: http://quicknat.ai-med.de

Link to arxiv versions of the papers:

Enjoy!!! :)

Getting Started

Pre-requisites

Please install the required packages for smooth functioning of the tool by running

pip install -r requirements.txt

Training your model

python run.py --mode=train

Evaluating your model

python run.py --mode=eval

Evaluating the model in bulk

Execute the following command for deploying on large datasets:

python run.py --mode=eval_bulk

This saves the segmentation files at nifti files in the destination folder. Also in the folder, a '.csv' file is generated which provides the volume estimates of the brain structures with subject ids for all the processed volumes.

Also uncertainty flag is set, another two '.csv' files are created with structure-wise uncertainty (CVs and IoU) for quality control of the segmentations. Please refer to the "Bayesian QuickNAT" paper for details.

Pre-processing: Before deploying our model you need to standardize the MRI scans. Use the following command from FreeSurfer

mri_convert --conform <input_volume.nii> <out_volume.nii>

The above command standardizes the alignment for QuickNAT, re-samples to isotrophic resolution (256x256x256) with some contrast enhamcement. It takes about one second per volume.

You need to modify the following entries in 'settings_eval.ini' file in the repo.

Code Authors

Help us improve

Let us know if you face any issues. You are always welcome to report new issues and bugs and also suggest further improvements. And if you like our work hit that start button on top. Enjoy :)