Skip to main content

Advanced Normalization Tools in Python

Project description

Advanced Normalization Tools in Python

img

Build Status Coverage Status Documentation Status ci-docker Contributor Covenant Binder

About ANTsPy

Search ANTsPy documentation at read the docs.

ANTsPy is a Python library which wraps the C++ biomedical image processing library ANTs, matches much of the statistical capabilities of ANTsR, and allows seamless integration with numpy, scikit-learn, and the greater Python community.

ANTsPy includes blazing-fast IO (~40% faster than nibabel for loading Nifti images and converting them to numpy arrays), registration, segmentation, statistical learning, visualization, and other useful utility functions.

ANTsPy also provides a low-barrier opportunity for users to quickly wrap their ITK (or general C++) code in Python without having to build an entire IO/plotting/wrapping code base from scratch - see C++ Wrap Guide for a succinct tutorial.

If you want to contribute to ANTsPy or simply want to learn about the package architecture and wrapping process, please read the extensive contributors guide.

If you have any questions or feature requests, feel free to open an issue or email Nick (ncullen at pennmedicine dot upenn dot edu).

Installation

We recommend that users install the latest pre-compiled binaries, which takes ~1 minute. Note that ANTsPy is not currently tested for Python 2.7 support. Copy the following command and paste it into your bash terminal:

For MacOS and Linux:

pip install antspyx

If we do not have releases for your platform, then use:

git clone https://github.com/ANTsX/ANTsPy
cd ANTsPy
python3 setup.py install

if you want more detailed instructions on compiling ANTsPy from source, you can read the installation tutorial.

NOTE: we are hoping to relatively soon release windows wheels via pip. If they are not yet available, please check the discussion in the issues for how to build from source on windows machines.

Recent wheels

Look under the "Actions" tab. Then click on the commit for the software version you want. Wheels for some of these commits will be available by downloading its "artifacts".

Docker images

Available on Docker Hub. To build ANTsPy docker images, see the (installation tutorial)(https://github.com/ANTsX/ANTsPy/blob/master/tutorials/InstallingANTsPy.md#docker-installation).


ANTsR Comparison

Here is a quick example to show the similarity with ANTsR:

ANTsR code:

library(ANTsR)
img   <- antsImageRead(getANTsRData("r16"))
img   <- resampleImage(img, c(64,64), 1, 0 )
mask  <- getMask(img)
segs1 <- atropos(a=img, m='[0.2,1x1]', c='[2,0]', i='kmeans[3]', x=mask )

ANTsPy code:

from ants import atropos, get_ants_data, image_read, resample_image, get_mask
img   = image_read(get_ants_data("r16"))
img   = resample_image(img, (64,64), 1, 0 )
mask  = get_mask(img)
segs1 = atropos(a=img, m='[0.2,1x1]', c='[2,0]', i='kmeans[3]', x=mask )

Tutorials

We provide numerous tutorials for new users: https://github.com/ANTsX/ANTsPy/tree/master/tutorials

5 minute Overview

Nibabel Speed Comparison

Composite registrations

other notes on compilation

in some cases, you may need some other libraries if they are not already installed eg if cmake says something about a missing png library or a missing Python.h file.

sudo apt-get install libblas-dev liblapack-dev
sudo apt-get install gfortran
sudo apt-get install libpng-dev
sudo apt-get install python3-dev  # for python3.x installs

Build documentation

cd docs
sphinx-apidoc -o source/ ../
make html

References

  1. See references at the main ANTs page.

  2. Google scholar search reveals plenty of explanation of methods and evaluation results by ourselves

  3. ANTs evaluation and comparison by other authors

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.3.8.tar.gz (248.7 MB view hashes)

Uploaded Source

Built Distributions

antspyx-0.3.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (326.3 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

antspyx-0.3.8-cp310-cp310-win_amd64.whl (175.5 MB view hashes)

Uploaded CPython 3.10 Windows x86-64

antspyx-0.3.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (326.3 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

antspyx-0.3.8-cp310-cp310-macosx_10_9_x86_64.whl (306.2 MB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

antspyx-0.3.8-cp39-cp39-win_amd64.whl (175.5 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

antspyx-0.3.8-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (326.3 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

antspyx-0.3.8-cp39-cp39-macosx_13_0_universal2.whl (241.2 MB view hashes)

Uploaded CPython 3.9 macOS 13.0+ universal2 (ARM64, x86-64)

antspyx-0.3.8-cp39-cp39-macosx_10_9_x86_64.whl (306.2 MB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

antspyx-0.3.8-cp38-cp38-win_amd64.whl (175.5 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

antspyx-0.3.8-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (326.3 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

antspyx-0.3.8-cp38-cp38-macosx_10_9_x86_64.whl (306.2 MB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

antspyx-0.3.8-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (326.4 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

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