Coder Social home page Coder Social logo

brats18_docker's Introduction

Automatic Brain Tumor Segmentation using Convolutional Neural Networks with Test-time augmentation

Dockerfile and supporting files to create a new Docker image from the Source Code at brats18 for brain tumor segmentation, which is a revision of the original implementation of brats17 according to the following paper:

*Guotai Wang, Wenqi Li, Sebastien Ourselin, Tom Vercauteren. "Automatic Brain Tumor Segmentation using Cascaded Anisotropic Convolutional Neural Networks." In International MICCAI Brainlesion Workshop, pp. 178-190. Springer, Cham, 2017. https://arxiv.org/abs/1709.00382

The brats18 code supports test time augmentation, where the final prediction for a test image is obtained by fusing predictions of multiple transformed versions of that image. This is the main difference from the brats17 code.

How to use

  1. Download the source code of this repositry, and the source code of brats18 project.
git clone https://github.com/taigw/brats18_docker.git
cd brats18_docker
git clone https://github.com/taigw/brats18.git
  1. Build the docker image.
docker build . < Dockerfile

You will get some screen outputs like Successfully built 4dff82933875 where 4dff82933875 is the docker image id.

  1. Set docker memory to 16G.

Since GPU computing with docker is not implemented, only CPU is used when running the segmentation code in docker. The code requires a large memory and ~300s for segmenting one brain tumor with CPU. Please set the memory for docker to 16G, as illustrated in the following:

A slice from BRATS17

  1. Open the ./single_prediction.sh file and edit directory and my_image.
# content of ./single_prediction.sh
directory=/Users/guotaiwang/Documents/data/BraTS2018_Validation
my_image=4dff82933875
docker run -v $directory:/data --workdir=/usr/src/app -i -t $my_image python docker/main.py docker/test_cfg.txt

where directory is the dir in which the testing images are stored, such as BraTS2018_Validation and BraTS2018_Testing. Please set directory as full path of the folder containing testing images. Then the folder should look like:

Testing Path

Set my_image as the docker image id obtained in the previous step. Note that each time when you build the docker image, the id may change and my_image should be reset accordingly.

  1. Now run the bash file to start the segmentation with single prediction (no test-time augmentation).
bash ./single_prediction.sh

The segmentation results will be saved to $directory/Brats18_XXXX_XX_1/results/tumor_tiggw_class.nii.gz.

  1. To use test-time augmentation with multiple predictions. Open the ./multiple_predictions.sh file and edit directory and my_image.
# content of ./multiple_predictions.sh
directory=/Users/guotaiwang/Documents/data/BraTS2018_Validation
my_image=4dff82933875
docker run -v $directory:/data --workdir=/usr/src/app -i -t $my_image python docker/main.py docker/test_cfg_tta1.txt
docker run -v $directory:/data --workdir=/usr/src/app -i -t $my_image python docker/main.py docker/test_cfg_tta2.txt
docker run -v $directory:/data --workdir=/usr/src/app -i -t $my_image python docker/main.py docker/test_cfg_tta3.txt
docker run -v $directory:/data --workdir=/usr/src/app -i -t $my_image python docker/main.py docker/test_cfg_tta4.txt
docker run -v $directory:/data --workdir=/usr/src/app -i -t $my_image python docker/main.py docker/test_cfg_tta5.txt
docker run -v $directory:/data --workdir=/usr/src/app -i -t $my_image python docker/vote_result.py docker/vote_result_cfg.txt

As an example, five predictions are obtained and then fused into a single prediction here.

  1. Now run the bash file to start the segmentation with multiple predictions (test-time augmentation).
bash ./multiple_predictions.sh

The segmentation results will be saved to $directory/Brats18_XXXX_XX_1/results/tumor_tiggw_class.nii.gz.

Note

The current version of this docker repository only supports cpu-based computation, which is far slower than using gpu. To run the code with GPU, please see non-dockered version of brats18.

brats18_docker's People

Watchers

James Cloos avatar  avatar paper2code - bot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.