Skip to main content

T1w human neuroimage processing with antspyx

Project description

ANTsPyT1w

CircleCI

reference processing for t1-weighted neuroimages (human)

the outputs of these processes can be used for data inspection/cleaning/triage as well for interrogating neuroscientific hypotheses.

this package also keeps track of the latest preferred algorithm variations for production environments.

install by calling (within the source directory):

python setup.py install

or install via pip install antspyt1w

what this will do

  • provide example data

  • brain extraction

  • denoising

  • n4 bias correction

  • brain parcellation into tissues, hemispheres, lobes and regions

  • hippocampus specific segmentation

  • t1 hypointensity segmentation and classification exploratory

  • deformable registration with robust and repeatable parameters

  • registration-based labeling of major white matter tracts

  • helpers that organize and annotate segmentation variables into data frames

  • hypothalamus segmentation FIXME/TODO

the two most time-consuming processes are hippocampus-specific segentation (because it uses augmentation) and registration. both take 10-20 minutes depending on your available computational resources and the data. both could be made computationally cheaper at the cost of accuracy/reliability.

first time setup

import antspyt1w
antspyt1w.get_data()

NOTE: get_data has a force_download option to make sure the latest package data is installed.

example processing

import os
os.environ["TF_NUM_INTEROP_THREADS"] = "8"
os.environ["TF_NUM_INTRAOP_THREADS"] = "8"
os.environ["ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS"] = "8"

import antspyt1w
import antspynet
import ants

##### get example data + reference templates
# NOTE:  PPMI-3803-20120814-MRI_T1-I340756 is a good example of our naming style
# Study-SubjectID-Date-Modality-UniqueID
# where Modality could also be measurement or something else
fn = antspyt1w.get_data('PPMI-3803-20120814-MRI_T1-I340756', target_extension='.nii.gz' )
img = ants.image_read( fn )

# generalized default processing
myresults = antspyt1w.hierarchical( img, output_prefix = '/tmp/XXX' )

##### organize summary data into data frames - user should pivot these to columns
# and attach to unique IDs when accumulating for large-scale studies
# see below for how to easily pivot into wide format
# https://stackoverflow.com/questions/28337117/how-to-pivot-a-dataframe-in-pandas

An example "full study" (at small scale) is illustrated in ~/.antspyt1w/run_dlbs.py which demonstrates/comments on:

  • how to aggregate dataframes
  • how to pivot to wide format
  • how to join with a demographic/metadata file
  • visualizing basic outcomes.

to publish a release

python3 -m build
python -m twine upload -u username -p password  dist/*

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

antspyt1w-0.6.0.tar.gz (36.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

antspyt1w-0.6.0-py3-none-any.whl (36.0 kB view details)

Uploaded Python 3

File details

Details for the file antspyt1w-0.6.0.tar.gz.

File metadata

  • Download URL: antspyt1w-0.6.0.tar.gz
  • Upload date:
  • Size: 36.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for antspyt1w-0.6.0.tar.gz
Algorithm Hash digest
SHA256 c9cbc5818e6dcb07896aafe5da6f79c590048f2c1c63b695fed1d1d5f08e1b59
MD5 484a9bb6f10996f3614f7a2060ddf648
BLAKE2b-256 a42350287061183d5674e651c30b404376e9ddd4e1e9a3c334ea98917ef2cb08

See more details on using hashes here.

File details

Details for the file antspyt1w-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: antspyt1w-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 36.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for antspyt1w-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7352ec6659ad5c4fa3f450688aa30adad85a505fee4617920615e404a6c3daf8
MD5 adfbd6f106d9d2731cd47914350d6e55
BLAKE2b-256 f07b94982d0c7a93a9bf1008a67b51c52e7e27fda7dac45e7d79344b1a2958db

See more details on using hashes here.

Supported by

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