GithubHelp home page GithubHelp logo

neuronets / brainy Goto Github PK

View Code? Open in Web Editor NEW
2.0 4.0 0.0 2.6 MB

Automated brain segmentation

Dockerfile 1.73% Python 98.27%
tensorflow brain segmentation mri neuroimaging trained-models brain-extraction

brainy's Introduction

Automated Brain Extraction

This model achieved a median Dice score of 0.97, mean of 0.96, minimum of 0.91, and maximum of 0.98 on a validation dataset of 99 T1-weighted brain scans and their corresponding binarized FreeSurfer segmentations (public and private sources). This model should be agnostic to orientation and can predict the brainmask for a volume of size 256x256x256 in approximately three seconds.

This model was trained for five epochs on a dataset of 10,000 T1-weighted brain scans comprised of both public and private data. The ground truth labels were binarized FreeSurfer segmentations (i.e., binarized aparc+aseg.mgz). All volumes were size 256x256x256 and had 1mm isotropic voxel sizes. Because the full volumes could not fit into memory during training, each volume was separated into non-overlapping blocks of size 128x128x128, and training was performed on blocks in batches of two. The Jaccard loss function was used. During training, approximately 50% of the volumes were augmented with random rigid transformations. That is to say, 50% of the data was rotated and translated randomly in three dimensions (the transformation for pairs of features and labels was the same). The augmented features were interpolated linearly, and the augmented labels were interpolated with nearest neighbor. Each T1-weighted volume was standard scored (i.e., Z-scored) prior to training.

Predicted brain mask on T1-weighted brain scan

Predicted brain mask on T1-weighted brain scan with motion

! CAUTION: this tool is not a medical product and is only intended for research purposes. !

Requirements for use

  • Input data should be T1-weighted magnetic resonance images. The model was trained and evaluated on this type of data.
  • CPU or, optionally, GPU
    • Runtime will be much faster when a GPU is available. Please see the Singularity usage example below for running the model on a GPU.

Singularity usage example

To run using singularity, first pull the image:

singularity pull docker://neuronets/brainy:latest-gpu

You have a few options when running the image. To see them call help.

singularity run --cleanenv --bind $(pwd):/data -W /data --nv brainy_latest-gpu.sif --help

Here is an example.

singularity run --cleanenv --bind $(pwd):/data -W /data --nv \
    brainy_latest-gpu.sif T1_001.nii.gz output

This will generate two files output.nii.gz and output_orig.nii.gz. The first is the mask in conformed FreeSurfer space. The second is the mask in the original input space.

Docker usage example

Instead of singularity with GPU, once can also use Docker directly. This is an example with a CPU. Note that the CPU-based run is significantly slower.

docker run -it --rm -v $(pwd):/data --user 1001:1000 neuronets/brainy:latest-cpu T1_001.nii.gz output

The above examples assume there is a file named T1_001.nii.gz in the working directory. The option --user 1001:1000 runs the container with user ID 1001 and group ID 1000. This will prevent the created files from being owned by root. Replace the IDs with your own IDs. On Unix-like systems, one can use id -u and id -g to get user ID and group ID, respectively.

DockerHub tags

The DockerHub tags follow the following naming scheme:

  • master-gpu: gpu version of current GitHub master
  • latest-gpu: gpu version of latest release
  • SEMVER-gpu: gpu version of semantically versioned release

for cpu versions replace gpu with cpu

nobrainer

This model is based on the nobrainer framework. The original model is publicly available and can be found on neuronets/trained-models.

The pre-trained model can be downloaded via datalad.

brainy's People

Contributors

hoda1394 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  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.