Skip to main content

Deep Learning tool for brain tumor segmentation.

Project description


Build Status PyPI version Documentation Status License: MIT

This repo utilize a ensemble of 2-D and 3-D fully convoultional neural network (CNN) for segmentation of the brain tumor and its constituents from multi modal Magnetic Resonance Images (MRI). The dense connectivity pattern used in the segmentation network enables effective reuse of features with lesser number of network parameters. On the BraTS validation data, the segmentation network achieved a whole tumor, tumor core and active tumor dice of 0.89, 0.76, 0.76 respectively.


  • <input type="checkbox" checked="" disabled="" /> Brain Tumor Segmentation
  • <input type="checkbox" checked="" disabled="" /> Brain Mask Generation SkullStripping (currently using HD-BET and ANTs)
  • <input type="checkbox" checked="" disabled="" /> Radiomic Features
  • <input type="checkbox" checked="" disabled="" /> Coregistration
  • <input type="checkbox" checked="" disabled="" /> Dcm and nifty support (converts dcm to nifty and works)
  • <input type="checkbox" checked="" disabled="" /> UI based inference framework
  • <input type="checkbox" checked="" disabled="" /> Finetuning
    • <input type="checkbox" checked="" disabled="" /> Hardmining
    • <input type="checkbox" checked="" disabled="" /> Gradual Unfreezing
  • <input type="checkbox" disabled="" /> Whole Brain Segmentation


PyPi based installation:

python version: 3.5

installation: pip install DeepBrainSeg


git clone
cd DeepBrainSeg
python3 install


If you use DeepBrainSeg, please cite our work:

  title={Ensemble of Fully Convolutional Neural Network for Brain Tumor Segmentation from Magnetic Resonance Images},
  author={Kori, Avinash and Soni, Mehul and Pranjal, B and Khened, Mahendra and Alex, Varghese and Krishnamurthi, Ganapathy},
  booktitle={International MICCAI Brainlesion Workshop},

Pipeline for Segmentation


Results for Segmentation



We also provide UI based tool for tumor segmentation visualization. It can be used by running the following commands after cloning the repo.

cd ui

normal overlay2


Python API usage

Brain tumor segmentation

for data in BraTs format

from DeepBrainSeg import deepSeg
segmentor = deepSeg(quick=True)

for other formats

from DeepBrainSeg import deepSeg
t1_path = 
t2_path = 
t1ce_path = 
flair_path = 

segmentor = deepSeg(quick=True)
segmentor.get_segmentation(t1_path, t2_path, t1ce_path, flair_path, save = True)

brain seq coregistration to t1c

from DeepBrainSeg.registration import Coregistration
coreg = Coregistration()

moving_imgs = {'t1': t1path,
               't2': t2path,
               'flair': flairpath}
fixed_img =  os.path.join(t1cpath)
coreg.register_patient(moving_images    = moving_imgs,
                            fixed_image = fixed_img,
                            save_path   = pathtosave)

brain mask extraction (skull stripping)

from DeepBrainSeg.brainmask.hdbetmask import get_bet_mask
from DeepBrainSeg.brainmask.antsmask import get_ants_mask

get_bet_mask(vol_path, savepath)


get_ants_mask(vol_path, savepath)

Radiomics feature exctractor

from DeepBrainSeg.radiomics import ExtractRadiomicFeatures

extractor = ExtractRadiomicFeatures(input_mask=None, 
                                    class_ = 'ET')



Steps followed for tumor segmentation inference:

  • Our algorithm makes use of ANTs framework for mask generation. First call deepSeg class build ANTs framework locally in ~/.DeepBrainSeg
  • First call deepSeg downloads all pretrained models locally in ~/.DeepBrainSeg
  • Final segmentation is the result of ensemble of 4 different models:
    • ABLNet (, Air brain Lesion Network)
    • 3DBrainNet (, 3D multiresolution CNN)
    • Tiramisu2D (, 57 layered 2D CNN)
    • Tiramisu 3D (, 57 layered 3D CNN)
  • Extensive documentation will be uploaded soon, along with transfer learning framework
  • More details about network architecture and training procedure can be found here

For training code please refer this repo


Windows 10 Installation Guide

image Figure_0: DeepBrainSeg starting up on Windows 10.


Figure_1: DeepBrainSeg used to get brain segmentation on Windows 10. (Note: Ensemble segmentation/inference takes ~2 hours via torch_cpu, on my i7 6700 intel cpu. Torch cuda/gpu on the other hand, is much faster, with ensemble segmentation/inference taking only ~10 minutes, on my gtx 1060 3gb)

Installation Guide: here



Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for DeepBrainSeg, version 0.2.1
Filename, size File type Python version Upload date Hashes
Filename, size DeepBrainSeg-0.2.1.tar.gz (37.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page