Catalyst.Neuro [](https://join.slack.com/t/catalyst-team-core/shared_invite/zt-d9miirnn-z86oKDzFMKlMG4fgFdZafw) [](https://github.com/catalyst-team/neuro/graphs/contributors)

September 13, 2021 ยท View on GitHub

This repository provides a 3D Brain Segmentation Pipeline for a structural magnetic resonance imaging (MRI) scan using the Catalyst framework using the Mindboggle Dataset as an example. It also provides pre-trained models for Gray Matter White Matter (GMWM) segmentation, 104 class brain atlas segmentation, and 31 class brain atlas segmentation and with usage shown in example notebooks. Segmenting a structural MRI is an important processing step that enables subsequent inferences about tissue changes in development, aging, and disease. This work is based on the following papers: An (almost) instant brain atlas segmentation for large-scale studies and End-to-end learning of brain tissue segmentation from imperfect labeling.

Developed in a partnership with

Catalyst logo

Brain image analysis

Pretrained Model Statistics

ModelClasses# of Brains (Training)# of Brains (Validation)# of Brains TestMacro DICE
MeshNet GMWM32044.9565
MeshNet Dropout GMWM32044.8748
MeshNet Large GMWM32044.9652
MeshNet Large GMWM32044.9624
UNet GMWM32044.9624
MeshNet Large Mindboggle31701020.6742
UNet Mindboggle31701020.6771
MeshNet Large HCP Atlas10477027100~.85
ModelInference SpeedModel Size
MeshNet GMWM116 subvolumes/sec.89 mb
MeshNet Dropout GMWM115 subvolumes/sec.89 mb
MeshNet Large GMWM19 subvolumes/sec9mb
MeshNet Large Dropout GMWM19 subvolumes/sec9mb
UNet GMWM13 subvolumes/sec288 mb
MeshNet Large Mindboggle19 subvolumes/sec9 mb
UNet Mindboggle13 subvolumes/sec288 mb
MeshNet Large HCP Atlas18 subvolumes/sec10 mb

Download links are in the Example Segmentation Notebooks

Example Segmentation Notebooks

Training MeshNet on Mindboggle

You can reproduce MeshNet for Mindboggle with 5 simple steps

  • Install requirements
    conda env create -f neuro_conda.yml
    conda activate neuro
    pip install -r ./requirements/requirements.txt
    
  • Download data. You need to have an account on the open science framework.
    mkdir Mindboggle_data
    osf -p 9ahyp clone Mindboggle_data
    cp -r Mindboggle_data/osfstorage/Mindboggle101_volumes/ data/Mindboggle_data/
    
    If you don't want to make an OSF account the files can also be downloaded
    the correct folder using these commands:
    
    download-gdrive 1l3YCRW7ezV9pw0e3aeYDFi4VsAm_DO7l data/Mindboggle_data/
    download-gdrive 1fxvqrs98F1Gnozg-HsxCjfTrw5zJbQxm data/Mindboggle_data/
    download-gdrive 1w0VXG7mLkE9tULPIxhnNK0qyguuQ7Zx8 data/Mindboggle_data/
    download-gdrive 1soDBWB0iXb3Dc1XarSKgfgwiKDInSLQw data/Mindboggle_data/
    download-gdrive 1jmwE69imokKJJaPKdCNK0Qlxb_r1bGN4 data/Mindboggle_data/
    
    
  • Unzip data and remove archive files
    find data/Mindboggle_101 -name '*.tar.gz'| xargs -i tar zxvf {} -C data/Mindboggle_101
    find data/Mindboggle_101 -name '*.tar.gz'| xargs -i rm {}
    
  • Prepare data (31 is the number of classes in the example. 102 is the full number of classes in Mindboggle)
    python neuro/scripts/prepare_data.py ./data/Mindboggle_101 31
    
  • Start training
    python neuro/minimal_example.py
    

MRI Segmentation Datasets

Mindboggle dataset uses manual annotations which are considered the gold standard. Manually labeling a single MRI can take a week of expert labeling. The labeling is done using a 2D display, one slice at a time which can lead to accuracy/ consistency issues. For our pre-trained models, we use automated labels from the Human Connectome Project (HCP), which can be downloaded here. The automated labeling tool used (FreeSurfer) employs probabilistic methods with priors to perform segmentation and is the current SOTA. While running FreeSurfer involves more than segmentation, it can take hours to segment a single MRI from FreeSurfer vs. minutes for a MeshNet model.

HCP Data preparation

  • Prepare T1 or T2 input with mri_convert from FreeSurfer to conform T1 to 1mm voxel size in coronal slice direction with side length 256. You can skip this step if your T1 image is already with slice thickness 1mm x 1mm x 1mm and 256 x 256 x 256.
mri_convert *brainDir*/t1.nii *brainDir*/T1.nii.gz -c
  • Prepare 104 atlas labels from aparc+aseg.nii.gz for HCP atlas segmentation using:
python neuro/scripts/prepare_atlas_data.py --brains_list *brains_list.txt*
  • Or Prepare GMWM labels from aparc+aseg.mgz using:
./bin/mk_gwmwm_labels.sh [input_directory] [output_directory]

Catalyst logo

Accelerated Deep Learning R&D

Pipi version Docs PyPI Status

Twitter Telegram Slack Github contributors