Skip to main content

A fast medical imaging analysis library in Python with algorithms for registration, segmentation, and more.

Project description

Advanced Normalization Tools in Python

Coverage Status PyPI - Downloads Nightly Build ci-pytest ci-docker Docker Pulls Contributor Covenant PubMed

The ANTsPy library wraps the well-established C++ biomedical image processing framework ANTs. It includes blazing-fast reading and writing of medical images, algorithms for registration, segmentation, and statistical learning, as well as functions to create publication-ready visualizations.

If you are looking to train deep learning models on medical imaging datasets, you might be interested in ANTsPyNet which provides tools for training and visualizing deep learning models.


Installation

Pre-compiled binaries

The easiest way to install ANTsPy is via the latest pre-compiled binaries from PyPI.

pip install antspyx

Because of limited storage space, pip binaries are not available for every combination of python version and platform. We also have had to delete older releases to make space. If you cannot find a binary you need on PyPI, you can check the Releases page for archived binaries.

Some Mac OS Python installations have compatibility issues with the pre-compiled binaries. This means pip will not install binaries targeted for the current Mac OS version, and will instead try to compile from source. The compatibility checks can be disabled by setting the environment variable SYSTEM_VERSION_COMPAT=0. More details on the wiki.

Building from source

In some scenarios, it can make sense to build from source. In general, you can build ANTsPy as you would any other Python package.

git clone https://github.com/antsx/antspy
cd antspy
python -m pip install .

Further details about installing ANTsPy or building it from source can be found in the Installation Tutorial.


Quickstart

Here is a basic overview of some of the things you can do with ANTsPy. The main functionality includes reading / writing images, basic and advanced image operations, segmentation, registration, and visualization.

import ants

# read / write images
img = ants.image_read('path/to/image.nii.gz')
ants.image_write(img, 'path/to/image.nii.gz')

# basic operations
img + img2
img - img2
img[:20,:20,:20] # indexing returns an image

# advanced operations
img = ants.smooth_image(img, 2)
img = ants.resample_image(img, (3,3,3))
img.smooth_image(2).resample_image((3,3,3)) # chaining

# convert to or from numpy
arr = img.numpy()
img2 = ants.from_numpy(arr * 2)

# segmentation
result = ants.atropos(a=img, m='[0.2,1x1]', c='[2,0]', i='kmeans[3]', x=ants.get_mask(img))

# registration
result = ants.registration(fixed_image, moving_image, type_of_transform = 'SyN' )

# plotting
ants.plot(img, overlay = img > img.mean())

Tutorials

Resources for learning about ANTsPy can be found in the tutorials folder. A selection of especially useful tutorials is presented below.

  • Basic overview [Link]
  • Composite registrations [Link]
  • Multi-metric registration [Link]
  • Image math operations [Link]
  • Wrapping ITK code [Link]

More tutorials can be found in the ANTs repository.


Contributing

If you have a question or bug report the best way to get help is by posting an issue on the GitHub page. We welcome any new contributions and ideas. If you want to add code, the best way to get started is by reading the contributors guide that runs through the structure of the project and how we go about wrapping ITK and ANTs code in C++.

You can support our work by starring the repository, citing our methods when relevant, or suggesting new features in the issues tab. These actions help increase the project's visibility and community reach.


References

The main references can be found at the main ANTs repo. A Google Scholar search also reveals plenty of explanation of methods and evaluation results by the community and by ourselves.

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

antspyx-0.5.4.tar.gz (7.2 MB view details)

Uploaded Source

Built Distributions

antspyx-0.5.4-cp312-cp312-win_amd64.whl (8.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

antspyx-0.5.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (22.2 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

antspyx-0.5.4-cp312-cp312-macosx_14_0_arm64.whl (16.5 MB view details)

Uploaded CPython 3.12 macOS 14.0+ ARM64

antspyx-0.5.4-cp312-cp312-macosx_12_0_x86_64.whl (20.0 MB view details)

Uploaded CPython 3.12 macOS 12.0+ x86-64

antspyx-0.5.4-cp311-cp311-win_amd64.whl (8.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

antspyx-0.5.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (22.2 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

antspyx-0.5.4-cp311-cp311-macosx_14_0_arm64.whl (16.5 MB view details)

Uploaded CPython 3.11 macOS 14.0+ ARM64

antspyx-0.5.4-cp311-cp311-macosx_12_0_x86_64.whl (20.0 MB view details)

Uploaded CPython 3.11 macOS 12.0+ x86-64

antspyx-0.5.4-cp310-cp310-win_amd64.whl (8.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

antspyx-0.5.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (22.2 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

antspyx-0.5.4-cp310-cp310-macosx_14_0_arm64.whl (16.5 MB view details)

Uploaded CPython 3.10 macOS 14.0+ ARM64

antspyx-0.5.4-cp310-cp310-macosx_12_0_x86_64.whl (20.0 MB view details)

Uploaded CPython 3.10 macOS 12.0+ x86-64

antspyx-0.5.4-cp39-cp39-win_amd64.whl (8.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

antspyx-0.5.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (22.2 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

antspyx-0.5.4-cp39-cp39-macosx_12_0_x86_64.whl (20.0 MB view details)

Uploaded CPython 3.9 macOS 12.0+ x86-64

antspyx-0.5.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (22.2 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

File details

Details for the file antspyx-0.5.4.tar.gz.

File metadata

  • Download URL: antspyx-0.5.4.tar.gz
  • Upload date:
  • Size: 7.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for antspyx-0.5.4.tar.gz
Algorithm Hash digest
SHA256 893e5b45175e278c1e5ab2c4c663f4dbcb08098ee842ba35eca73d785f263749
MD5 e8d0b4737a0a0ddd54d85f9cb510431b
BLAKE2b-256 96bcb4e0eaec74079cb21fcd6b2206b9bad3273eff474c3472b5cf5ff39f3585

See more details on using hashes here.

File details

Details for the file antspyx-0.5.4-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: antspyx-0.5.4-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 8.7 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for antspyx-0.5.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7705628994baf094e0ec240c0fe3ed6424edc81cca9add4011a368972dd96215
MD5 371e667368bfc2cbaa22804b17bdd287
BLAKE2b-256 102c7c91ed0cf9789674b7e50017fa82c4f3f816ca5110caf3729a2ab095af65

See more details on using hashes here.

File details

Details for the file antspyx-0.5.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for antspyx-0.5.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b61cdc43459fc1038f9eea65d148be630fc442c0753ef6d484c0ec6d435d74de
MD5 fcb367ae07d674085c7b824906946b38
BLAKE2b-256 3ea7f6afa9ac026db460605d4db5dedce7e5e62cba38941d727a9d38d6f80378

See more details on using hashes here.

File details

Details for the file antspyx-0.5.4-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for antspyx-0.5.4-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 1856de7cd182667443743ecb2efc6977bbd1e66b739178b330650c759d57df4a
MD5 febd1f42bd54b1f239ebba75a24cbdac
BLAKE2b-256 dc51c3a8f423356e5c0719c7fa882e88b54a69b7c9b9bcb4d4217f13fc71b94e

See more details on using hashes here.

File details

Details for the file antspyx-0.5.4-cp312-cp312-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for antspyx-0.5.4-cp312-cp312-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 314cf1b7a690c4254c3569254db5e1752baf620c8cd49835a0115a53d85cb498
MD5 a05b29b2358b57440db9421e77e5e5b6
BLAKE2b-256 a238d3ec9e86eea0d78bafff581fdfb132d0a2cfad881789dfa52bfc1f1f2aff

See more details on using hashes here.

File details

Details for the file antspyx-0.5.4-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: antspyx-0.5.4-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 8.7 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for antspyx-0.5.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 15c29fdd2975cc9905cc55d494faf1c7e7d2d56310805c4019623c4e04e8b678
MD5 64cd56b680e0ad1dcd0c798dde7b7ab3
BLAKE2b-256 eaa79ebddf309d7378dd9a77062b70991542441fdcfabe1ba5dde0ae4fcfad1a

See more details on using hashes here.

File details

Details for the file antspyx-0.5.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for antspyx-0.5.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 37235e75f7c361f96e83333f05a979e494eebf47ae69e9f9f8da924c8cc88f37
MD5 558892abde158e547bf55c855fd5cfe2
BLAKE2b-256 7f93170f139c88c68aece49af9ea5086f3c5554cc271343cb957c6141bf54b07

See more details on using hashes here.

File details

Details for the file antspyx-0.5.4-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for antspyx-0.5.4-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 b3a3269c6989cbe543c3a8e0f47f03ed4e3d61e851881b9cd7f402bce6bbc8cd
MD5 f2b3f7315dc6d897db4309d66ddb8028
BLAKE2b-256 ed4ee2af318ea7d8892c1550f22ab528a742a0b19f699853617f46a0428a290e

See more details on using hashes here.

File details

Details for the file antspyx-0.5.4-cp311-cp311-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for antspyx-0.5.4-cp311-cp311-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 299a890ccbe17616834a6e637ea11f25f03d299bc537e5148583859151368d20
MD5 c1b28e8cfe07635b8dd3c62d1610fe35
BLAKE2b-256 eaccb1faa00140d046e74b2030cfb9725c19cc9a13452888550eb50208c66b87

See more details on using hashes here.

File details

Details for the file antspyx-0.5.4-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: antspyx-0.5.4-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 8.7 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for antspyx-0.5.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b45198c5792e456d21943fefd37625849d496a07a5264281dfa999ec21581fe0
MD5 3085a957124718fafe756f9a80af7f6e
BLAKE2b-256 4e527e6c5cd78d1671ec4ff8ac20a4b3769ed75ff8878c143818f3cff6bce4f1

See more details on using hashes here.

File details

Details for the file antspyx-0.5.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for antspyx-0.5.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ffdb471fcc805f4f9d689d19253ea2993c646552738cb1a8a68b8d8017e57820
MD5 fd93a9090167f96156e90cb8dc4d4660
BLAKE2b-256 f869eccf2743a6fe71e09792f1b1f9afc5c992680f2defcccf3b84525d1e0020

See more details on using hashes here.

File details

Details for the file antspyx-0.5.4-cp310-cp310-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for antspyx-0.5.4-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 64c9f633aa94297ae379c7a1220dab3e399d5ff6c617efff30f90ef1802be6ef
MD5 a7a01cebccb00b3e0c41d3063eb65371
BLAKE2b-256 75241c0c3605318e10936c296a02d2d89fffb6b550083518d12af644b7681f29

See more details on using hashes here.

File details

Details for the file antspyx-0.5.4-cp310-cp310-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for antspyx-0.5.4-cp310-cp310-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 42037a9dc9b02ac0d0393ba98cb945723b489f49709dceb0b51cf02447f44577
MD5 7a8fae686edffce1eef356672826fa4f
BLAKE2b-256 5ff08a27ec4d4f632014b7405caac2de662d2573367c3bac87075d1feec3ac1a

See more details on using hashes here.

File details

Details for the file antspyx-0.5.4-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: antspyx-0.5.4-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 8.7 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for antspyx-0.5.4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 ed10b48d19d34aeda3ea31f1b1d43996612e4e294c29183aeb9b97a3b6e860dd
MD5 08f70ca593a6f0925fd86ed26757ae1f
BLAKE2b-256 cea553b986ee3471093b349b769afdd68e8439d628331581f96dc52675c5fe29

See more details on using hashes here.

File details

Details for the file antspyx-0.5.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for antspyx-0.5.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 39b830bfd33aef433f13742ea5b83244f1bd76a85fe33cd54ab953f3d13d15e0
MD5 112816f48c4bc30b6b08d9e4516d1991
BLAKE2b-256 91aa8572114f6b17fc2ae1e9040774141c185dc774a520ffaaddbb5e6b3602bc

See more details on using hashes here.

File details

Details for the file antspyx-0.5.4-cp39-cp39-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for antspyx-0.5.4-cp39-cp39-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 9c495073f09154ed1b3f32fab2026efd8c9549d2002beefc35386dea7136676d
MD5 35135ec664bcb6b4758eed7bc30c923c
BLAKE2b-256 964c21228b468b7416f33c403a1a77a3a1cddf8e569ec98f582392b73988aa4b

See more details on using hashes here.

File details

Details for the file antspyx-0.5.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for antspyx-0.5.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8499989a797ba36428b21fad916246c08e11dd0870e58ccc71c728e392598b3f
MD5 f56d299b4eea39e2ddebc940a663998e
BLAKE2b-256 9bc68b2f2af67f01e76b2be7a2a2cedd8dc897b74ae128f87e94a3569a2a7a9e

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