Skip to main content

brain extraction in python

Project description

brainextractor

A reimplementation of FSL's Brain Extraction Tool in Python.

Follows the algorithm as described in:

Smith SM. Fast robust automated brain extraction. Hum Brain Mapp.
2002 Nov;17(3):143-55. doi: 10.1002/hbm.10062. PMID: 12391568; PMCID: PMC6871816.

Install

To install, simply use pip to install this repo:

# install from pypispheresphere
pip install brainextractor

# install repo with pip
pip install git+https://github.com/vanandrew/brainextractor@main

# install from local copy
pip install /path/to/local/repo

Note that it is recommended to use brainextractor on python 3.7+

Usage

To extract a brain mask from a image, you can call:

# basic usage
brainextractor [input_image] [output_image]

# example
brainextractor /path/to/test_image.nii.gz /path/to/some_output_image.nii.gz

You can adjust the fractional intensity with the -f flag:

# with custom set threshold
brainextractor [input_image] [output_image] -f [threshold]

# example
brainextractor /path/to/test_image.nii.gz /path/to/some_output_image.nii.gz -f 0.4

To view the deformation process, you can use the -w flag to write the surfaces to a file. Then use brainextractor_render to view them:

# writes surfaces to file
brainextractor [input_image] [output_image] -w [surfaces_file]

# load surfaces and render
brainextractor_render [surfaces_file]

# example
brainextractor /path/to/test_image.nii.gz /path/to/some_output_image.nii.gz -w /path/to/surface_file.surfaces

brainextractor_render /path/to/surface_file.surfaces

If you need an explanation of the options at any time, simply run the help:

brainextractor --help

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

brainextractor-0.2.0.tar.gz (12.1 kB view details)

Uploaded Source

File details

Details for the file brainextractor-0.2.0.tar.gz.

File metadata

  • Download URL: brainextractor-0.2.0.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

File hashes

Hashes for brainextractor-0.2.0.tar.gz
Algorithm Hash digest
SHA256 dc2bb3dc20b2fae7225c82b9bb5eb50ff6482c6d4bb2fc20634d93d172ef10c3
MD5 21b0f3def5bbfcb928549e61962110ce
BLAKE2b-256 e5fae77c064f1874c6a2668ddba734d2233f3a45fb0cda9dd2cf3ee7bb3a9223

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