Advanced Normalization Tools in Python
Project description
Advanced Normalization Tools in Python
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
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for antspyx-0.3.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | abac68ce802987d259d276975f8bd16eab23ea495d787f5601ed91e02643212d |
|
MD5 | 1ede8fdd1a49a2197053635054df7817 |
|
BLAKE2b-256 | dd2fa81d5629ef8e545cffd86368756962682a7386a80601fe35387e4aaffa23 |
Hashes for antspyx-0.3.8-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d1d52338186f64cadaeea28772ed0568a599b4c7f3179cb91c40cfd941eb4c3 |
|
MD5 | eaeb67f8759c6e6bc919601620db8b44 |
|
BLAKE2b-256 | e556d1f1cf1b2b42f1c964f4ce490b974f048aefebb1f3f3e41dad88c5fd1339 |
Hashes for antspyx-0.3.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5dedc4d8e44785907fb346dba7726d443e0f11c36e85be134ddc5e90e490d0fd |
|
MD5 | 575470e3c9cb5ef1909756692e1b95e8 |
|
BLAKE2b-256 | c605b423e188dcac875184714617dc40add846c0104b21d06835a6c395090bc6 |
Hashes for antspyx-0.3.8-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c8777bcd8c25c2c2b7c5ab43fad4cbf0d854e081ae9d0c98da7cc6c5d9ffd30 |
|
MD5 | e3d1f1ad11acab345770860207bac504 |
|
BLAKE2b-256 | 0b238a59be0941932baca07680b27fb5127f2588e9195e8b0493faaf5503dfc9 |
Hashes for antspyx-0.3.8-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1af23977c28c04f2d4dab04963306d3df9f2684dd133020d79bc0ff6243870dd |
|
MD5 | 9b01511a9d845751cb67a5a42b015794 |
|
BLAKE2b-256 | 5ece94e7919acac227c827b9d2953e83308bddc1964cfe8863cbbda784a97cd7 |
Hashes for antspyx-0.3.8-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d0c9b9602b9440c7df9071e6cf85b24d86ef6e2839dc565302b17bfe1d3d7f1 |
|
MD5 | 0f4d6a6b3d13305e7a17fb8dc4c46f5a |
|
BLAKE2b-256 | ec43d45142f730c90feb00b86fc09478a4def66cea4191b07d1cd56e18d3fae1 |
Hashes for antspyx-0.3.8-cp39-cp39-macosx_13_0_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83b071a98481e9aed11e9d724e81acbd99be2721a8b7a261f3ae8f5a37831acf |
|
MD5 | c18b5cad27224f6c1c928f5af49c5c30 |
|
BLAKE2b-256 | 964923134e78b0ceba7a91140a13fa8ec1d06c8931b99aae6133c5cd0330d100 |
Hashes for antspyx-0.3.8-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08d37634ac8ae405738c0b5e5d5d942db122e53236f40b486e03dbe51bc3c5db |
|
MD5 | bfe6118a752be570858aa61e67972c16 |
|
BLAKE2b-256 | 90078ed946e178ced782221ff4763d9e1f09648fdc463520e857b7af045e2731 |
Hashes for antspyx-0.3.8-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 947aa54fc8de11611aa851102ab79bf4a88cfa094acb2025e46d95e29d9a26b0 |
|
MD5 | e02b9b883be1a61ef2448b11931f8802 |
|
BLAKE2b-256 | c163cc60e69b3ccbb24899f97b891b17e903f17bc42bc472402f208c387f1c09 |
Hashes for antspyx-0.3.8-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6e85963b7177af4e1b808fecc56b3abe9914f5e2efd9637e4c6f571a7d69f1f |
|
MD5 | bc6d771c42d1081c8d6b3869063e85c9 |
|
BLAKE2b-256 | 74c97d945cce77a40e15780f115b45f9dedb75bd98def293575f5c3703f94e00 |
Hashes for antspyx-0.3.8-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47ad371f13f21c0e758260a4ee9ac582ea9d2491c6c53ae7276e4ef995003fa7 |
|
MD5 | 1138e9a3c5afde983d72c8e8da7d513f |
|
BLAKE2b-256 | 8801d8ef1f29a6b42c395c7e9cff5862b90948438402d246016a4fda361fd0ff |
Hashes for antspyx-0.3.8-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a62f97cbb8498e2f841e9da9d34d1634d06892abbac4868d8cad4e4365f0d3dc |
|
MD5 | f188172b63b62cbdca5925ebfc3a6681 |
|
BLAKE2b-256 | d91a0bd916822ee80b31f5b5992126a5af411166e9563719b52ffe37181eb487 |