taigw / brats17

Brain tumor segmentation for MICCAI 2017 BraTS challenge
BSD 3-Clause "New" or "Revised" License
321 stars 130 forks source link

Overview

This repository provides source code and pre-trained models for brain tumor segmentation with BraTS dataset. The method is detailed in [1], and it won the 2nd place of MICCAI 2017 BraTS Challenge. In addition, it is adapted to deal with BraTS 2015 dataset.

This implementation is based on NiftyNet and Tensorflow. While NiftyNet provides more automatic pipelines for dataloading, training, testing and evaluation, this naive implementation only makes use of NiftyNet for network definition, so that it is lightweight and extensible. A demo that makes more use of NiftyNet for brain tumor segmentation is proivde at https://github.com/NifTK/NiftyNet/tree/dev/demos/BRATS17

If you use any resources in this repository, please cite the following papers:

An example of brain tumor segmentation result.

Requirements

How to use

1, Prepare data

2, Use pre-trained models to segment images

python test.py config15/test_all_class.txt
python test.py config17/test_all_class.txt

3, How to train

The trainig process needs 9 steps, with axial view, sagittal view, coronal view for whole tumor, tumor core, and enhancing core, respectively.

The following commands are examples for BraTS 2017. However, you can edit the corresponding *.txt files for different configurations.

python train.py config17/train_wt_ax.txt
python train.py config17/train_wt_sg.txt
python train.py config17/train_wt_cr.txt
python train.py config17/train_tc_ax.txt
python train.py config17/train_tc_sg.txt
python train.py config17/train_tc_cr.txt
python train.py config17/train_en_ax.txt
python train.py config17/train_en_sg.txt
python train.py config17/train_en_cr.txt
python util/rename_variables.py

You may need to edit this file to set different parameters. As an example for Brats 2015, after running this command, you will see a model named model15/msnet_tc32sg_init that is copied from model15/msnet_tc32_20000.ckpt. Then just set start_iteration=1 and model_pre_trained=model15/msnet_tc32sg_init in config15/train_tc_sg.txt.

4, How to test

Similar to 'Use pre-trained models', write a configure file that is similar to config15/test_all_class.txt or config17/test_all_class.txt and set the value of model_file to your own model files. Run:

python test.py your_own_config_for_test.txt

5, Evaluation

Calcuate dice scores between segmentation and the ground truth, run:

python util/evaluation.py

You may need to edit this file to specify folders for segmentation and ground truth.

Copyright