Skip to main content

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.

ssl error

if you get an odd certificate error when calling force_download, try:

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

to publish a release

before doing this - make sure you have a recent run of pip-compile pyproject.toml

rm -r -f build/ antspyt1w.egg-info/ dist/
python3 -m  build .
python3 -m pip install --upgrade twine
python3 -m twine upload --repository antspyt1w dist/*

Metadata

Release files for antspyt1w 1.1.3

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

Source distribution (sdist)

Source distribution for antspyt1w 1.1.3
File Size Uploaded
antspyt1w-1.1.3.tar.gz 48.5 kB Details

Built distribution (wheel)

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

Total release size: 89.8 kB

Release files / antspyt1w-1.1.3.tar.gz

Download URL antspyt1w-1.1.3.tar.gz
Size 48.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e6c8cd83682fc09161ccffb23d3ab9bac020e769e4d1f5ee57690aea601eb0d1
BLAKE2b-256 checksum
How to use checksums
3fb26affdbac4ca7cb39f9664483093515a645c9fd37f2ff283cd127b45093a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.9

Release files / antspyt1w-1.1.3-py3-none-any.whl

Download URL antspyt1w-1.1.3-py3-none-any.whl
Size 41.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fc36829b8e6fc62aa443669567ffe0ce6891e17ec39a46667fbcb9130c616a4c
BLAKE2b-256 checksum
How to use checksums
55965b9fc7be46edfac10c8d67307ad6f8a29e1859e22a2a6ea28c9ccb339fb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

1.1.3 This release

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.9.9

2 release files

0.9.8

2 release files

0.9.7

2 release files

0.9.6

2 release files

0.9.4

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.9

2 release files

0.8.8

2 release files

0.8.7

2 release files

0.8.5

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.9

2 release files

0.7.7

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

1 release file

0.7.1

2 release files

0.7.0

2 release files

0.6.9

2 release files

0.6.8

2 release files

0.6.7

2 release files

0.6.6

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.9

1 release file

0.5.8

1 release file

0.5.7

1 release file

0.5.6

1 release file

0.5.5

1 release file

0.5.4

1 release file

0.5.3

1 release file

0.5.2

1 release file

0.5.1

2 release files

0.5.0

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

3 release files

0.4.4

2 release files

0.4.2

2 release files

0.4.0

3 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

3 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.0

3 release files

0.1.8

3 release files

0.1.7

2 release files

0.1.6

3 release files

0.1.5

3 release files

0.1.4

2 release files

0.1.3

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