ITK 5.2.0 available for download

May 28, 2021

We are happy to announce the release of Insight Toolkit (ITK) 5.2.0! ITK is an open-source, cross-platform toolkit for N-dimensional scientific image processing, segmentation, and registration.

ITK 5.2 is a feature release that improves and extends interfaces to deep learning, artificial intelligence (AI) libraries, with an emphasis on Project MONAI, the Medical Open Network for AI. ITK 5.2 feature highlights include functional filter support for PyTorch tensors, Python dictionary interfaces to itk.Image metadata, NumPy-based pixel indexing, 4D Python image support, and improved multi-component image support.

Changes from Release Candidate 3 include an updated Python Quick Start Guide and many improvements to the ITK Sphinx Examples.

Experimental pip-installable Python packages are available for ARMv8 on macOS for the Apple M1 Silicon processor, and Linux, also known as aarch64. For a scientific computing environment on these platforms, we recommend mini-forge.

The pip-installable Python packages work with conda across all platforms. We are working to add native conda-forge packages in a future release.

All Pythonic, functional filter interfaces have type annotations with common, standard types along with numpy.typing.ArrayLike and

Many other improvements were made since RC 3 based on community feedback. A full list can be found in the Changelog below.


Python Packages

Install ITK Python packages with:

pip install --upgrade itk

Guide and Textbook

Library Sources

Testing Data

Unpack optional testing data in the same directory where the Library Source is unpacked.



MONAI-compatible itk.Image metadata dict and NumPy-indexing pixel set/get Python interfaces.

  image['origin'] = [4.0, 2.0, 2.0]

or a dictionary can be retrieved with:

  meta_dict = dict(image)

For example:

In [3]: dict(image)
{'0008|0005': 'ISO IR 100',
 '0008|0008': 'ORIGINAL\\PRIMARY\\AXIAL',
 '0008|0016': '1.2.840.10008.',
 '0008|0018': '',
 '0008|0020': '20010822',

For non-string keys, they are passed to the NumPy array view so array views can be set and get with NumPy indexing syntax, e.g.

In [6]: image[0,:2,4] = [5,5]

In [7]: image[0,:4,4:6]
NDArrayITKBase([[    5,  -997],
                [    5, -1003],
                [ -993,  -999],
                [ -996,  -994]], dtype=int16)

Provides a Python dictionary interface to image metadata, keys are
MetaDataDictionary entries along with ‘origin’, ‘spacing’, and
*’direction’ keys. The latter reverse their order to be consistent with
the NumPy array index order resulting from array views of the image.

The itk.xarray_from_image and itk.image_from_xarray functions gained support for transfer of itk MetaDataDictionary and xarray attrs along with support for ordering xarray DataArray dims.

Pythonic enhancements

Improved Xarray support was added in the functional filter support for NumPy ndarray-like images, i.e. a numpy.ndarray, Dask Array or xarray.DataArrays.

itk.Image now provides an astype() method for casting to a NumPy dtype or itk pixel type.

In addition to single files or an image stack in a Python list, a directory can be passed to itk.imread containing a DICOM series. A spatially ordered 3D image will be obtained.

The conversion functions, itk.vtk_image_from_image() and itk.image_from_vtk_image() are directly available for working with VTK.

We now generate .pyi Python interface files, providing better feedback in integrated development environments (IDE)’s like PyCharm.

Python code was modernized for Python 3.6, including some typehints. We now use the black Python style.

An itk.set_nthreads() convenience function is available to set the default number of threads. Support is now available for use in the Python multiprocessing module.

In addition to itk.imread, itk.imwrite, itk.meshread, itk.meshwrite, spatial transformation IO functions are available, itk.transformread, itk.transformwrite.

To provide an itk.ImageIOBase derived object to read a specific file format, itk.imread and itk.imwrite gained support for the imageio keyword argument.

Python package layout improvements

Python support module organization has been organized into the* package.

Python development was added for multi-config CMake generators, e.g. Visual Studio or multi-config Ninja, with the limitation that it only works with the most recently built configuration. When developing ITK Python wrapping or ITK remote modules, copy the WrapITK.pth build tree file to your virtual environment or conda environment site-packages to experiment with the wrapping.

Python package advances

Improved VectorImage and multi-component image support is available in the ITK Python packages.

NumPy is now a required package dependency.

Python packages are now built with interprodedural optimizations (IPO). Linux Python packages are built with the manylinux2014 toolchain.

Binary Python packages are available for ARM on macOS and Linux.

Python packages are available for Python 3.6 to 3.9. Following CPython deprecation schedule, this is the last release to support Python 3.6.

C++ interface improvements

A new itk::FunctionCommand class is available, an itk::Command subclass that calls std::function objects or lambda functions.

New itk::ReadImage, itk::WriteImage convenience functions are available for reading and writing image files with minimal code.

An itk::Image now supports operator== and operator!=.

A new itk::TernaryGeneratorImageFilter class is now available.

Third party library updates

Updates were made for the third party libraries:

  • GDCM
  • HDF5
  • double-conversion
  • pygccxml
  • castxml
  • swig
  • VXL
  • KWSys
  • MetaIO
  • cuFFTW

Remote Module Updates

We added a new adaptive denoising remote module.

Many remote modules were updated: AdaptiveDenoising, AnalyzeObjectLabelMap, AnisotropicDiffusionLBR, BSplineGradient, BioCell, BoneEnhancement, BoneMorphometry, Cuberille, FixedPointInverseDisplacementField, GenericLabelInterpolator, HigherOrderAccurateGradient, IOFDF, IOMeshSTL, IOOpenSlide, IOScanco, IOTransformDCMTK, IsotropicWavelets, LabelErodeDilate, LesionSizingToolkit, MGHIO, MeshNoise, MinimalPathExtraction, Montage, MorphologicalContourInterpolation, MultipleImageIterator, ParabolicMorphology, PerformanceBenchmarking, PhaseSymmetry, PolarTransform, PrincipalComponentsAnalysis, RLEImage, RTK, SCIFIO, SimpleITKFilters, SkullStrip, SmoothingRecursiveYvvGaussianFilter, SplitComponents, Strain, SubdivisionQuadEdgeMeshFilter, TextureFeatures, Thickness3D, TotalVariation, TubeTK, TwoProjectionRegistration, and VariationalRegistration.
Their updates are included in the detailed changelog below.

Support for cross-platform C++ testing, Python package generation, and PyPI deployment with GitHub Actions was added to almost all remote modules.

Test coverage and bug fixes

A multitude of test code coverage improvements were made — our code coverage is now 90.09% with 127,103 lines tested.

Many more bug fixes and improvements have been made. For details, see the changelog below.


Congratulations and thank you to everyone who contributed to this release.

Of the 63 authors who contributed since v5.1.0, we would like to specially recognize the new contributors:

Horea Christian, Baptiste Depalle, David Thompson, Pierre Wargnier, Darren Thompson, Sebastien Brousmiche, Alexander Burchardt, Marco Nolden, Michael Kuczynski, MrTzschr, Bernhard M. Wiedemann, Charles Garraud, Lee Newberg, Bryn Lloyd, Gregory Lee, justbennet, Kenji Tsumura, Zhiyuan Liu, Jonathan Daniel, Moritz Schaar, Atri Bhattacharya, Mon-ius, Michael Jackson, Tom Birdsong, Alex Domingo, Laurent Malka, Kris Thielemans, Andreas Huber, and Melvin Robinson.

And the new contributors since v5.2rc03:

Michael Kuczynski, Flanz, Robert, Adrien Boucaud, Tom Birdsong, and suryanshsangwan.

What’s Next

Our next feature release, ITK 5.3, will follow a few patch releases. Remote module Python packages will be updated to leverage and work with itk-5.2.0.post3. Join the community discussion at Contribute with pull requests, code reviews, and issue discussions in our GitHub Organization.

Enjoy ITK!

Leave a Reply