Skip to main content

Image registration toolbox based on pyTorch

Project description

                                      _     _ 
                                     (_)   | |
  _ __ ___   ___ _ __ _ __ ___   __ _ _  __| |
 | '_ ` _ \ / _ \ '__| '_ ` _ \ / _` | |/ _` |
 | | | | | |  __/ |  | | | | | | (_| | | (_| |
 |_| |_| |_|\___|_|  |_| |_| |_|\__,_|_|\__,_|

 

Documentation Status Build Status

iMagE Registration via autoMAtIc Differentiation

Mermaid is a registration toolkit making use of automatic differentiation for rapid prototyping. It is written in PyTorch and runs on the CPU and the GPU. Though GPU acceleration only becomes obvious for large images or 3D volumes. It supports registration of 1D (functions), 2D, and 3D images.

The easiest way to install a development version is to clone the repository, create a virtual conda environment and install it in there. This can be done as follows for a development installation:

conda create --name mermaid python=3.7 pip
conda activate mermaid
python setup.py develop

Or like this if you want to do a standard installation of mermaid:

conda create --name mermaid python=3.7 pip
conda activate mermaid
python setup.py install

There is also a nice documentation which can be built by executing

cd mermaid
cd docs
make html

You can also find the latest version on readthedocs:

https://mermaid.readthedocs.io/en/latest/index.html

In the near future there will also be a conda installer available. This will then allow installations via

conda install -c pytorch -c conda-forge -c anaconda -c uncbiag mermaid

There are already initial OSX/Linux versions available which can be installed via conda, but there are still some issues that need to be ironed out, so they might not be fully functional yet. Stay tuned.

Supported transformation models:

  • affine_map: map-based affine registration
  • diffusion_map: displacement-based diffusion registration
  • curvature_map: displacement-based curvature registration
  • total_variation_map: displacement-based total variation registration
  • svf_map: map-based stationary velocity field
  • svf_image: image-based stationary velocity field
  • svf_scalar_momentum_image: image-based stationary velocity field using the scalar momentum
  • svf_scalar_momentum_map: map-based stationary velocity field using the scalar momentum
  • svf_vector_momentum_image: image-based stationary velocity field using the vector momentum
  • svf_vector_momentum_map: map-based stationary velocity field using the vector momentum
  • lddmm_shooting_map: map-based shooting-based LDDMM using the vector momentum
  • lddmm_shooting_image: image-based shooting-based LDDMM using the vector momentum
  • lddmm_shooting_scalar_momentum_map: map-based shooting-based LDDMM using the scalar momentum
  • lddmm_shooting_scalar_momentum_image: image-based shooting-based LDDMM using the scalar momentum
  • lddmm_adapt_smoother_map: map-based shooting-based Region specific diffemorphic mapping, with a spatio-temporal regularizer
  • svf_adapt_smoother_map: map-based shooting-based vSVF, with a spatio regularizer

Supported similarity measures:

  • ssd: sum of squared differences
  • ncc: normalize cross correlation
  • ncc_positive: positive normalized cross-correlation
  • ncc_negative: negative normalized cross-correlation
  • lncc: localized normalized cross correlation (multi-scale)

Supported solvers:

  • embedded RK4
  • torchdiffeq: explicit_adams, fixed_adams, tsit5, dopri5, euler, midpoint, rk4

Optimizer:

  • support single/multi-scale optimizer
  • support SGD, l-BFGS and some limited support for adam

easyreg

We also wrote a companion python package, easyreg, which allows training deep networks for image registration based on the registration models available in mermaid. I.e., easyreg allows training networks that backpropagate through the mermaid transformation models (SVF, LDDMM, ...). You can have a look at the package here:

https://github.com/uncbiag/easyreg

Our other registration work

See https://github.com/uncbiag/registration for an overview of other registration approaches of our group and a short summary of how the approaches relate.

Publishing a release

To publish to conda, just tag a version in the format "major.minor.subminor". do not add a leading v. Travis will automatically push to the conda repository at uncbiag/mermaid. After this is done, to publish to pip, first locally run

pip wheel . -w dist

to build the wheel, then run

twine upload --repository pypi dist/mermaid-<version_number>--py3-none-any.whl

to publish to pypi.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

mermaid-0.3.2-py3-none-any.whl (1.2 MB view details)

Uploaded Python 3

File details

Details for the file mermaid-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: mermaid-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.5.0.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for mermaid-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4632b4584d528e3d2c79f9557ebf9e618f3a264318312b5de6004e6e3c84cf49
MD5 e24162b948a4ce5314d65a397b4e0092
BLAKE2b-256 a7c4d259de417b44785e37107399e21c4868244c9baae127346a70119ca5a3a9

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