Skip to main content

DenseUnet-based Automatic Rapid brain Segmentation (DARTS)

Paper Associated with the project

Here is the paper describing the project and experiments in detail (Link to the paper to be updated).

Deep learning models for brain MR segmentation

We pretrain our Dense Unet model using the Freesurfer segmentations of 1113 subjects available in the Human Connectome Project dataset and fine-tuned the model using 101 manually labeled brain scans from Mindboggle dataset.

The model is able to perform the segmentation of complete brain within a minute (on a machine with single GPU). The model labels 102 regions in the brain making it the first model to segment more than 100 brain regions within a minute. The details of 102 regions can be found below.

Results on the Mindboggle held out data

The box plot compares the dice scores of different ROIs for Dense U-Net and U-Net. The Dense U-Net consistently outperforms U-Net and achieves good dice scores for most of the ROIs.

Using Pretrained models for performing complete brain segmentation

The users can use the pre-trained models to perform a complete brain MR segmentation. For using the coronally pre-trained models, the user will have to execute the perform_pred.py script. An illustration can be seen in predicting_segmentation_illustration.ipynb notebook.

The following code block could be used to perform the prediction:

usage: perform_pred.py [-h] [--input_image_path INPUT_IMAGE_PATH]
                       [--segmentation_dir_path SEGMENTATION_DIR_PATH]
                       [--file_name FILE_NAME] [--model_type MODEL_TYPE]
                       [--model_wts_path MODEL_WTS_PATH] [--is_mgz [IS_MGZ]]
                       [--save_prob [SAVE_PROB]] [--use_gpu [USE_GPU]]

optional arguments:
  -h, --help            show this help message and exit
  --input_image_path INPUT_IMAGE_PATH
                        Path to input image (can be of .mgz or .nii.gz
                        format)(required)
  --segmentation_dir_path SEGMENTATION_DIR_PATH
                        Directory path to save the output segmentation
                        (required)
  --file_name FILE_NAME
                        Name of the segmentation file (required)
  --model_type MODEL_TYPE
                        Model types: "dense-unet", "unet" (default: "dense-
                        unet")
  --model_wts_path MODEL_WTS_PATH
                        Path for model wts to be used (default='./saved_model_
                        wts/dense_unet_back2front_finetuned.pth')
  --is_mgz [IS_MGZ]     Is the image in .mgz format (default=False, default
                        format is .nii.gz)
  --save_prob [SAVE_PROB]
                        Should the softmax prob values for each voxel be saved
                        ? (default: False)
  --use_gpu [USE_GPU]   Use GPU for inference? (default: True)

An example could look something like this:

python3 perform_pred.py --input_image_path './../../../data_orig/199251/mri/T1.mgz' \
--segmentation_dir_path './sample_pred/' \
--file_name '199251' \
--is_mgz True \
--model_wts_path './saved_model_wts/dense_unet_back2front_non_finetuned.pth' \
--save_prob False \
--use_gpu True \
--save_prob False

Pretrained model wts

Pretrained model wts can be downloaded from here.

There are two model architectures: Dense U-Net and U-Net. Each of the model is trained using 2D slices extracted coronally, sagittally,or axially. The name of the model will contain the orientation and model architecture information.

Output segmentation

The output segmentation has 103 labeled segments with the last one being the None class. The labels of the segmentation closely resembles the aseg+aparc segmentation protocol of Freesurfer.

We exclude 4 brain regions that are not common to a normal brain: White matter and non-white matter hypointentisites, left and right frontal and temporal poles. We also excluded left and right 'unknown' segments. We also exclude left and right bankssts as there is no common definition for these segments that is widely accepted by the neuroradiology community.

The complete list of class number and the corresponding segment name can be found here.

Sample Predicitons

Insula

Here we can clearly see that Freesurfer (FS) incorrectly predicts the right insula segment, the model trained only using FS segmentations also learns a wrong prediction. Our proposed model which is finetuned on manually annotated dataset correctly captures the region. Moreover, the segment looks biologically natural unlike FS's segmentation which is grainy, noisy and with non-smooth boundaries.

Putamen

Here again, we see that FS segmentation is of low quality but our proposed fine-tuned model performs well and produces more natural looking segmentation.

Pallidum

FS segmentation for pallidum also of low quality, but the proposed model performs well.

More predicitons

Some sample predictions for Putamen, Caudate, Hippocampus and Insula can be seen here. In all the images, prediction 1 = Freesurfer, Prediction 2 = Non-Finetuned Dense Unet, Prediction 3 = Finetuned Dense Unet.

It could be seen that Freesurfer often make errors in determining the accurate boundaries whereas the deep learning based models have natural looking ROIs with accurate boundaries.

Contact

If you have any questions regarding the code, please contact ark576[at]nyu.edu or raise an issue on the github repo.

Metadata

Release files for DARTSeg 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for DARTSeg 1.0.0
File Size Uploaded
DARTSeg-1.0.0.tar.gz 11.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for DARTSeg 1.0.0
File Interpreter ABI Platform
DARTSeg-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 38.2 kB

Release files / DARTSeg-1.0.0.tar.gz

Download URL DARTSeg-1.0.0.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
361254643848a371c567db8765af04433d6505dfeba28496b80b5506cbab09ca
BLAKE2b-256 checksum
How to use checksums
c1c6c8416d4919b79bbfd477bc8fa8ccf3e20150ea99ef3c23b3d817d2d55fe8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.6.9

Release files / DARTSeg-1.0.0-py3-none-any.whl

Download URL DARTSeg-1.0.0-py3-none-any.whl
Size 26.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
773c7dfd578337dd8c3b2b232ef1a60175bbaec9fdee5257fb3f9170c631ab2a
BLAKE2b-256 checksum
How to use checksums
a4f3842e373df55ad9a8948234749217bdf015e885194bba5c3a3d7cb7e6d208
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.6.9

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page