Skip to content

An ITK Python interface to elastix, a toolbox for rigid and nonrigid registration of images

License

Notifications You must be signed in to change notification settings

InsightSoftwareConsortium/ITKElastix

Repository files navigation

ITKElastix

WebAssembly image PyPI Version binder voila License Versioned software citation

Overview

Provides an ITK Python, JavaScript, and WebAssembly interface to elastix, a toolbox for rigid and nonrigid registration of images.

elastix is open source software, based on the well-known Insight Toolkit (ITK). The software consists of a collection of algorithms that are commonly used to solve (medical) image registration problems. The modular design of elastix allows the user to quickly configure, test, and compare different registration methods for a specific application.

👨‍💻 Live JavaScript API Demo

Installation

Install cross-platform native binary Python packages with pip:

pip install itk-elastix

Experimental WebAssembly Python packages can be installed across platforms with:

pip install itkwasm-elastix

Note The API for the WebAssembly and native binary packages are slightly different. For the WebAssembly interface, see the package's Sphinx documentation. For the interface to the native binaries, see the examples/ directory in this repository.

JavaScript / TypesScript packages cas be installed with

npm install @itk-wasm/elastix

Usage

To register two images with the native Python binaries, traditionally called the fixed image and the moving image:

import itk

fixed_image = itk.imread('path/to/fixed_image.mha')
moving_image = itk.imread('path/to/moving_image.mha')

registered_image, params = itk.elastix_registration_method(fixed_image, moving_image)

Interactive examples and tutorial material can be found in the examples directory. Run the examples in free cloud compute containers on MyBinder or clone the repository and run the notebooks locally in Jupyter Notebook or Jupyter Lab. Try out the experimental GPU packages on Paperspace Gradient.

ITKElastix can be used with both the procedural and the object oriented method, as shown in the example notebooks. The procedural method is shorter, less explicit and currently slightly less functional than the object oriented method, however the execution time and output do not differ apart from possible differences due to the stochastic nature of the Elastix algorithm.

To find parameters that work well with specific datasets, see the elastix Model Zoo.

For a graphical user interface in a desktop application, see the napari plugin.

Additional documentation is available for the WebAssembly JavaScript bindings and WebAssembly Python bindings.

Acknowledgements

ITKElastix was developed in part with support from:

The lead developers of elastix are Stefan Klein and Marius Staring.

This software was initially developed at the Image Sciences Institute, under supervision of Josien P.W. Pluim. Today, many have contributed to elastix.

If you use this software anywhere we would appreciate if you cite the following articles:

  • K. Ntatsis, N. Dekker, V. Valk, T. Birdsong, D. Zukić, S. Klein, M Staring, M McCormick, "itk-elastix: Medical image registration in Python", Proceedings of the 22nd Python in Science Conference, pp. 101 - 105, 2023, https://doi.org/10.25080/gerudo-f2bc6f59-00d.

  • D.P. Shamonin, E.E. Bron, B.P.F. Lelieveldt, M. Smits, S. Klein and M. Staring, "Fast Parallel Image Registration on CPU and GPU for Diagnostic Classification of Alzheimer's Disease", Frontiers in Neuroinformatics, vol. 7, no. 50, pp. 1-15, January 2014.

This ITK module is based on SimpleElastix, created by Kasper Marstal. For more information, see:

  • Kasper Marstal, Floris Berendsen, Marius Staring and Stefajkn Klein, "SimpleElastix: A user-friendly, multi-lingual library for medical image registration", International Workshop on Biomedical Image Registration (WBIR), Las Vegas, Nevada, USA, 2016