Skip to main content

Fast brain extraction using neural networks

Project description


This is the official implementation of the deepbet paper.

deepbet is a neural network based tool, which achieves state-of-the-art results for brain extraction of T1w MR images of healthy adults, while taking ~1 second per image.

Usage

After installation, there are three ways to use deepbet

  1. deepbet-gui runs the Graphical User Interface (GUI)

deepbet-gui

  1. deepbet-cli runs the Command Line Interface (CLI)
deepbet-cli -i /path/to/inputs -o /path/to/output/brains
  1. Run deepbet directly in Python
from deepbet import run_bet

input_paths = ['path/to/sub_1/t1.nii.gz', 'path/to/sub_2/t1.nii.gz']
brain_paths = ['path/to/sub_1/brain.nii.gz', 'path/to/sub_2/brain.nii.gz']
mask_paths = ['path/to/sub_1/mask.nii.gz', 'path/to/sub_2/mask.nii.gz']
tiv_paths = ['path/to/sub_1/tiv.csv', 'path/to/sub_2/tiv.csv']
run_bet(input_paths, brain_paths, mask_paths, tiv_paths, threshold=.5, n_dilate=0, no_gpu=False)

Besides the input paths and the output paths

  • brain_paths: Destination filepaths of input nifti files with brain extraction applied
  • mask_paths: Destination filepaths of brain mask nifti files
  • tiv_paths: Destination filepaths of .csv-files containing the total intracranial volume (TIV) in cm³
    • Simpler than it sounds: TIV = Voxel volume * Number of 1-Voxels in brain mask

you can additionally do

  • Fine adjustments via threshold: deepbet internally predicts values between 0 and 1 for each voxel and then includes each voxel which is above 0.5. You can change this threshold (e.g. to 0.1 to include more voxels).
  • Coarse adjustments via n_dilate: Enlarges/shrinks mask by successively adding/removing voxels adjacent to mask surface.

and choose if you want to use GPU (only NVIDIA supported) for speedup

  • no_gpu: deepbet automatically uses the NVIDIA GPU if available. If you do not want that, set no_gpu=True.

Installation

For accelerated processing via GPU, it is recommended to first install PyTorch separately via a command customized for your system.

Then the package itself can be installed via

pip install deepbet

Due to this issue, the GUI can look ugly, which can be resolved via

conda install -c conda-forge tk=*=xft_*

Citation

If you find this code useful in your research, please consider citing

@article{deepbet,
    title = {deepbet: Fast brain extraction of T1-weighted MRI using Convolutional Neural Networks},
    journal = {Computers in Biology and Medicine},
    volume = {179},
    pages = {108845},
    year = {2024},
    issn = {0010-4825},
    doi = {https://doi.org/10.1016/j.compbiomed.2024.108845},
    url = {https://www.sciencedirect.com/science/article/pii/S0010482524009302},
    author = {Lukas Fisch and Stefan Zumdick and Carlotta Barkhau and Daniel Emden and Jan Ernsting and Ramona Leenings and Kelvin Sarink and Nils R. Winter and Benjamin Risse and Udo Dannlowski and Tim Hahn},
}

Project details


Download files

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

Source Distribution

deepbet-1.0.2.tar.gz (10.1 MB view details)

Uploaded Source

Built Distribution

deepbet-1.0.2-py3-none-any.whl (10.3 MB view details)

Uploaded Python 3

File details

Details for the file deepbet-1.0.2.tar.gz.

File metadata

  • Download URL: deepbet-1.0.2.tar.gz
  • Upload date:
  • Size: 10.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.9.12 Linux/5.15.0-105-generic

File hashes

Hashes for deepbet-1.0.2.tar.gz
Algorithm Hash digest
SHA256 2c679474ad627ea54d2c2c052e6f0a5b29204b5a542ceb15e745bb73a60a2d37
MD5 a80dbcd060db7ccd95bb6d87887aad82
BLAKE2b-256 f33a58436407458a3cf99ef2a92b8b2f3d7711d491a69512a92a978801c60bc7

See more details on using hashes here.

File details

Details for the file deepbet-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: deepbet-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.9.12 Linux/5.15.0-105-generic

File hashes

Hashes for deepbet-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1999e2ea00ec48f6233b95b96f3901a962d3f70431c63aeb985e8a49a198473c
MD5 c9e0aca4a91e1ac7978615d508e5dc78
BLAKE2b-256 00483550a510d020faf4d67e86c9f4d3154923d4f4965b6fa9651b5c51012094

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page