GithubHelp home page GithubHelp logo

xiyuweifeng267 / antspy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from antsx/antspy

0.0 0.0 0.0 92.26 MB

Advanced Normalization Tools in Python

Home Page: https://antspyx.readthedocs.io

License: Apache License 2.0

Shell 0.89% C++ 19.03% Python 41.93% C 0.09% PowerShell 0.42% CMake 0.67% Batchfile 0.37% Jupyter Notebook 36.54% Dockerfile 0.07%

antspy's Introduction

Advanced Normalization Tools in Python

img

Coverage Status Documentation Status Downloads PyPI - Downloads Build ci-docker Docker Pulls Contributor Covenant Binder PubMed

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

NOTE: old pip wheels will be deleted!!!

we dont have the quota on pypi to support more than one or two prior releases. if you care about this: (1) open a pypi issue requesting more quota for this project; (2) propose another alternative.

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

Because of limited storage space, pip binaries are not available for every combination of python version and platform. If we do not have releases for your platform, you can check the Github Releases page or build from source with:

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

or see below for an alternative strategy using pip. If you want more detailed instructions on compiling ANTsPy from source, you can read the installation tutorial.

Installing older versions

We cannot store the entire history of releases because storage space on pip is limited.

if you need an older release, you can check the Github Releases page or build from source.

Try something like:

pip install 'antspyx @ git+https://github.com/ANTsX/[email protected]'

which will attempt to build from source (requires a machine with developer tools).

Recent wheels

Non-release commits have wheels built automatically, which are available for download for a limited period. Look under the Actions tab. Then click on the commit for the software version you want. Recent commits will have wheels stored as "artifacts".

we build wheels locally like this:

rm -r -f build/ antspymm.egg-info/ dist/
python3 setup.py sdist bdist_wheel
pipx run twine upload dist/*

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

antspy's People

Contributors

stnava avatar ravnoor avatar ntustison avatar muschellij2 avatar cookpa avatar jennydaman avatar dangom avatar rueberger avatar tfmoraes avatar seogier avatar azylbertal avatar raamana avatar vascosa avatar borda avatar mschober1 avatar oesteban avatar halirutan avatar phistep avatar haesleinhuepf avatar poldrack avatar sadeghmsalehi avatar tommydino93 avatar megabitdragon avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.