ITK 5.2 Release Candidate 3 available for testing

ITK 5.2 Release Candidate 3 Release Notes

We are happy to announce the Insight Toolkit (ITK) 5.2 Release Candidate 3 is available for testing! :tada: 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, artificiayl 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.

Release Candidate 3 adds parallel, multi-label support in itk::ContourExtractor2DImageFilter. Spatial transform IO functions, itk.transformread, itk.transformwrite are available, similar to itk.imread, itk.imwrite, itk.meshread, itk.meshwrite. itk.xarray_from_image, itk.image_from_xarray gained support for transfer of itk MetaDataDictionary and xarray attrs. An itk.ImageIOBase derived object for itk.imread and itk.imwrite can now be provided with the imageio keyword argument. Many code coverage improvements were made along with a number of platform support improvements, including VTK interfaces and Apple M1 ARM64 support.


Python Packages

Install ITK Python packages with:

pip install --upgrade --pre itk

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 later 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.

Python functional filter support for PyTorch tensors

Similar to functional filter support for NumPy ndarray-like images, i.e. a numpy.ndarray, Dask Array or xarray.DataArrays, all itk.Image filters now support execution on PyTorch Tensor's.

For example:

import itk
import torch
import numpy as np

a = np.random.rand(50,50)
t = torch.from_numpy(a)
r = itk.median_image_filter(t)

Pythonic enhancements

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

In addition to since filtes or an image stack in a Python list, pass in a directory to itk.imread containing a DICOM series to obtain the appropriately ordered 3D image.

itk.vtk_image_from_image() and itk.image_from_vtk_image() 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.

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 a 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,10 3nelines 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 58 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, Michael Kuczynski, Alex Domingo, Laurent Malka, and Kris Thielemans.

And the new contributors since v5.2rc02:

Andreas Huber and Melvin Robinson.

What’s Next

This will be the last release candidate before the 5.2.0 release. Please try out the current release candidate, and discuss your experiences at We will hold a hackathon on March 17th :shamrock: to make improvements to the ITK Sphinx Examples – everyone is welcome to participate. Contribute with pull requests, code reviews, and issue discussions in our GitHub Organization.

Enjoy ITK!

ITK Changes Since v5.2rc02

Andreas Huber (1):

Bug Fixes

  • Fix number encoding to use C locale (#2297) (c01cd4b272)

Brad King (1):


  • Convert VNL import script to use update-third-party.bash (7e5d7c102d)

Dženan Zukić (9):


  • use master branch of GoogleTest until a stable version is released (58d757c4af)
  • manually update minimum CMake version to 2.8.12 to avoid warning (bddc08cede)
  • make shared variables local to facilitate code reuse/parallelism (e2f9212a3d)
  • reduce duplication in ContourExtractor2DImageFilter (830e704fcd)

Platform Fixes

  • fix rename error from re-basing parallel branches (4ceb80196f)

Style Changes

Miscellaneous Changes

  • manually update minimum CMake version to 2.8.12 to avoid warning" (eef7836fa3)
  • use master branch of GoogleTest until a stable version is released" (4699a88925)
  • 81312d110b (81312d110b)

GoogleTest Upstream (1):

Miscellaneous Changes

Hans Johnson (8):


Platform Fixes

  • Use ITK_MACROEND_NOOP_STATEMENT for GPU macro ending. (69804a7f77)
  • Preserve const qualifier for variable (482dab950f)
  • Prefer const pointer when value does not change (c2116d956b)

Style Changes

  • Make prototype match definition names (cde72b3e7d)
  • Throw expression should throw anonymous temporary values instead (8774989235)
  • Remove deprecated orientation enumeration codes (317567484e)
  • Use default member initialization (8751ef7502)

Jon Haitz Legarreta Gorroño (14):


  • Use strongly typed enums for `itk (e94bb37e4a)
  • Print all member variables. (433413321f)
  • Use itkBooleanMacro for ImageSpacing, InterpolateSurfaceLocation (80cd0ce654)
  • Increase code coverage (563b224ff8)

Platform Fixes

Bug Fixes

  • Fix Superclass name in RTTI macro (04e5d15459)
  • Fix itkMultiphaseSparseFiniteDifferenceImageFilterTest (9ec01eb7ef)
  • Fix Superclass name in RTTI macro (d8f088f277)
  • Fix uninitialized variable use in ANTS neighborhood correlation metric (72ea1f254c)
  • Initialize member variables (f60a74ec5a)

Style Changes

  • Rename ITK_EXERCISE_BASIC_OBJECT_METHODS class names arguments (091d0f7420)
  • Provide default initialization to constructor in header file (bd11fd58a7)
  • Use single forward slashes in CMakeLists.txt data paths (2abb4709e3)
  • Use the static `FixedArray (0a8acb1a35)

Lee Newberg (2):


  • support multiple labels in ContourExtractor2DImageFilter (e2cfba4629)

Bug Fixes

  • Fix crash of PythonExtrasTest when extra types are wrapped (9096c74111)

Mathew Seng (1):

Documentation Updates

  • Add Git upstreams for post-commit hook (1fca440760)

Matt McCormick (19):


  • xarray_from_image “c” coords uint32 type (2e4cb26705)
  • Module configuration exec to import (59ed43b127)
  • Add itk.transformread, itk.transformwrite (d09b0647bc)
  • imageio kwarg for imread, imwrite (d3012f54ea)
  • xarray_from_image .attr, image_from_xarray MetaDataDictionary support (66b9008455)
  • Content link synchronization for v5.2rc03 (d6951962a4)

Platform Fixes

  • Remove invalid Emscripten HDF5 link flags (6146b3a0dd)
  • Declare H5O__fsinfo_set_version (09f0b6a417)
  • Provide H5CX_set_apl declaration in H5Odeprec.c (44fb096785)
  • Provide H5CX_get_ohdr_flags declaration in H5Oint.c (7822911d2d)
  • Declare H5CX_set_libver_bounds in H5Rint.c (3e6f52e6aa)
  • Add output redirection for H5Tinit.c, H5lib_settings.c generation (f45fe863b2)
  • Include stdio.h for printf (6ce6cbd7d2)
  • Migrate ITKVtkGlue library configuration to itk-module-init.cmake (ace1934f9f)
  • Include directories for CastXML when wrapping ITKVtkGlue (d653aa14b3)

Bug Fixes

  • Remove Azure coverage CI build (2625429815)
  • Disable Emscripten exception for floating point exceptions (9f5529fb10)

Style Changes

MetaIO Maintainers (1):

Miscellaneous Changes

Mihail Isakov (1):

Bug Fixes

Niels Dekker (3):

Platform Fixes

  • Fix itkGPUKernelClassMacro(kernel) backward compatibility (6c06a28d43)

Style Changes

  • Remove virtual from itkGPUKernelClassMacro, use C++11 = delete (6fe4dcd40f)
  • Remove dynamic_cast and GetPointer() from LightObject (fb7937dad0)

Sean McBride (6):

Documentation Updates

  • Removed obsolete readme info regarding updating HDF5 (f5fd16e68a)

Platform Fixes

  • Remove prohibition against building Universal Binaries on macOS (1562d26709)
  • remove invalid double underscore usage (f9610760bf)
  • ignore try_compile fenv_t results on macOS (d8b22b369a)
  • cherrypicked HDF5 upstream changes for macOS universal binary support (4b2175fd0b)
  • Changed conditional include of emmintrin.h to use preprocessor (39ccd65d7e)

VXL Maintainers (2):

Miscellaneous Changes

ITK Examples Changes Since v5.2rc02

Mathew Seng (10):


  • Bump VTK version to 9.0.1 in Superbuild (b96567df)
  • Allow examples to be built without QuickView (f30851e5)
  • Configure examples that utilize VTK (f0798173)
  • Bump OpenCV version to 4.5.1 (e6124682)
  • Publish documentation after complete build (0387b3da)

Bug Fixes

  • Specify version for LevelSetV4Visualization examples (1ed5ce95)
  • Fix input for examples that use VTK (cddc856f)
  • Remove redundant/invalid imports to OpenCV (b8e6cf00)
  • Remove broken visualization tool (74a4c193)
  • Incorrect path for removing sphinx warning (d75e5fdd)

Matt McCormick (14):


  • Use wildcard for GitHub Actions artifact version (bdac9235)
  • Add Netlify configuration (9c0d8e2f)
  • Add .ipynb_checkpoints to .gitignore (81a58211)

Documentation Updates

  • Fix dashboard link (574d6bf7)
  • Place Jupyter Notebook section before Code (54f836da)
  • Rename UpsampleOrDownsampleAScalarImage to ResampleAScalarImage (86f62137)
  • Add Python code for ResampleAScalarImage (0a458df4)

Platform Fixes

  • Address various Sphinx warnings (37fa225d)

Bug Fixes

  • Superbuild installs required itk sphinx six packages (41f23c9c)
  • Remove relative paths for GitHub Actions artifacts (deddc10a)
  • MutualInformation outputBaseline.png → OutputBaseline.png (c60556b8)
  • Upgrade pip in the superbuild virtual environment (9c0d52d1)
  • Remove Compatibility/Deprecated group (b0777843)

Style Changes

  • Pythonic style for ResampleAVectorImage (4cdd7029)

Melvin Robinson (1):

Miscellaneous Changes

Tom Birdsong (10):


  • Update ITK CI tags to v5.2rc02 (3e1a0189)
  • Added ExhaustiveOptimizerv4 Python example (9c4713d4)
  • Added MutualInformation example notebooks (23b83823)
  • Added notebook for param space viz with ExhaustiveOptimizerv4 (13584e45)
  • Added RegisterTwoPointSets example notebook (2c476f2b)
  • Add nbmake notebook checks to CI (0d196eba)

Bug Fixes

  • Disable MutualInformationAffine example (c6dd70ec)
  • Fixed MutualInformationAffine cxx and baseline test parameters (448db3f6)
  • Added .binder folder for requirements.txt dependencies (66ad2c17)
  • Fixed MutualInformation notebook undefined behaviors (84a8bc8c)

tom.birdsong (1):


  • Add point set registration example (d50d4ef7)

What happened with the 5.2 release? There’s a tag in git, but the website still shows 5.1.2 as the current release, and the last rc was 2 months ago…

1 Like

I guess the holdup is with ironing out issues in Python packages. @matt.mccormick can provide authoritative answer.

There are many components to a release. A tag in the ITK repository is a good first step. Other steps are in progress. The announcement is expected in 1-2 weeks.