We are happy to announce the [Insight Toolkit (ITK)](https://itk.org) 5.1.0 release! :tada: ITK is an open-source, cross-platform toolkit for N-dimensional scientific image processing, segmentation, and registration.
ITK 5.1.0 is a feature release that improves and extends the major ITK 5.0 release. ITK 5.1.0 includes a [NumPy](https://numpy.org) and [Xarray](https://xarray.pydata.org) filter interface, clang-format enforced coding style, enhanced modern C++ range support, strongly-typed enum's, and much more.
A number of issues were addressed based on feedback from Release Candidate 3. Filters avoid extra copies when operating on NumPy arrays, and `itk.Image` is now a NumPy array-like. Remote module CI testing infrastructure has been migrated to GitHub Actions for C++ tests, Python package builds, and automated Python package deployment.
Downloads
---------
**Python Packages**
Install [ITK Python packages](https://itkpythonpackage.readthedocs.io/en/latest/Quick_start_guide.html) with:
pip install --upgrade itk
or:
conda install -c conda-forge itk
**Guide and Textbook**
- [InsightSoftwareGuide-Book1-5.1.0.pdf](https://github.com/InsightSoftwareConsortium/ITK/releases/download/v5.1.0/InsightSoftwareGuide-Book1-5.1.0.pdf)
- [InsightSoftwareGuide-Book2-5.1.0.pdf](https://github.com/InsightSoftwareConsortium/ITK/releases/download/v5.1.0/InsightSoftwareGuide-Book2-5.1.0.pdf)
**Library Sources**
- [InsightToolkit-5.1.0.tar.gz](https://github.com/InsightSoftwareConsortium/ITK/releases/download/v5.1.0/InsightToolkit-5.1.0.tar.gz)
- [InsightToolkit-5.1.0.zip](https://github.com/InsightSoftwareConsortium/ITK/releases/download/v5.1.0/InsightToolkit-5.1.0.zip)
**Testing Data**
Unpack optional testing data in the same directory where the Library Source is unpacked.
- [InsightData-5.1.0.tar.gz](https://github.com/InsightSoftwareConsortium/ITK/releases/download/v5.1.0/InsightData-5.1.0.tar.gz)
- [InsightData-5.1.0.zip](https://github.com/InsightSoftwareConsortium/ITK/releases/download/v5.1.0/InsightData-5.1.0.zip)
**Checksums**
- [MD5SUMS](https://github.com/InsightSoftwareConsortium/ITK/releases/download/v5.1.0/MD5SUMS)
- [SHA512SUMS](https://github.com/InsightSoftwareConsortium/ITK/releases/download/v5.1.0/SHA512SUMS)
Features
--------

Parabolic morphological filtering with the [ITKParabolicMorphology](https://github.com/InsightSoftwareConsortium/ITKParabolicMorphology) remote module. To install the new Python package: `pip install itk-parabolicmorphology`. Jupyter notebooks are provided as [examples](https://github.com/InsightSoftwareConsortium/ITKParabolicMorphology/tree/master/examples). For more information, see the [Insight Journal article](http://www.insight-journal.org/browse/publication/228), *Beare R. Morphology with parabolic structuring elements. The Insight Journal. January-June. 2008. http://www.insight-journal.org/browse/publication/228*.
GitHub Actions for ITK Remote Module Testing, Packaging, PyPI Deployment
A [GitHub Action configuration](https://gist.github.com/thewtex/aab3f401b27dfd262e508cf1019853f0) is available for ITK Remote Module continuous integration (CI) testing and Python packaging on Linux, macOS, and Windows. Continuous deployment (CD) is configured to upload packages to the [Python Package Index (PyPI)](https://pypi.org) when the repository is tagged. More information can be found in the [ITK Python Package ReadTheDocs](https://itkpythonpackage.readthedocs.io/en/master/Build_ITK_Module_Python_packages.html#github-automated-ci-package-builds) documentation.
Pass NumPy Array's or Xarray DataArray's to ITK Image Filters
The [Pythonic, functional-like interface](https://discourse.itk.org/t/itk-5-0-beta-1-pythonic-interface/1271) to all ITK image-to-image-filters now directly supports operation on [NumPy ndarray's](https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html), i.e. `numpy.ndarray`. If a `ndarray` is passed as an input, a `ndarray` is returned as an output.
For example,
smoothed = itk.median_image_filter(array, radius=2)
Previously, explicit conversion to / from an `itk.Image` was required with `itk.array_from_image` and `itk.image_from_array`.
We can now also convert an `itk.Image` to a `numpy.ndarray` with the standard `np.asarray` call.
import numpy as np
import itk
image = itk.imread('/path/to/image.tif')
array = np.asarray(image)
An `itk.Image` is now more NumPy array-like: `shape`, `ndim`, and `dtype` attributes are available; these correspond to the values when converted to a NumPy `ndarray`. Basic NumPy functions can be called directly on an `itk.Image`, i.e.,
min = np.min(image)
max = np.max(image)
mean = np.mean(image)
Similar, experimental support (subject to change) is also available for [Xarray DataArray's](https://xarray.pydata.org/en/stable/generated/xarray.DataArray.html). If an `xarray.DataArray` is passed as an input, an `xarray.DataArray` is returned as an output. Moreover, the operation preserves spatial and dimensional metadata. For example,
import xarray as xr
import itk
image = itk.imread('/path/to/image.tif')
da = itk.xarray_from_image(image)
smoothed = itk.median_image_filter(da, radius=3)
print(smoothed)
results in:
<xarray.DataArray (y: 288, x: 894)>
array([[255. , 255. , 255. , ..., 255. , 255. , 255. ],
[ 11.9995, 11.9995, 11.9995, ..., 11.9995, 11.9995, 11.9995],
[ 11.9995, 11.9995, 11.9995, ..., 11.9995, 11.9995, 11.9995],
...,
[ 11.9995, 11.9995, 11.9995, ..., 11.9995, 11.9995, 11.9995],
[ 11.9995, 11.9995, 11.9995, ..., 11.9995, 11.9995, 11.9995],
[ 11.9995, 11.9995, 11.9995, ..., 11.9995, 11.9995, 11.9995]],
dtype=float32)
Coordinates:
* x (x) float64 0.0 1.0 2.0 3.0 4.0 ... 889.0 890.0 891.0 892.0 893.0
* y (y) float64 0.0 1.0 2.0 3.0 4.0 ... 283.0 284.0 285.0 286.0 287.0
Attributes:
direction: [[1. 0.]\n [0. 1.]]
A round trip is possible with `itk.image_from_xarray`.
Python 3 Only
ITK 5.1 will be the first Python 3-only release. Consistent with most scientific Python packages and [CPython's 2020 drop in support](https://pythonclock.org), Python 2 support and binaries are no longer available.
Python Package 64-bit Float Support
In addition to the many other pixel types supported, the `itk` binary Python packages now include support for the `double` pixel type, i.e. 64-bit IEEE floating-point pixels. This improves compatibility with [scikit-image](https://scikit-image.org/), which uses this pixel type as a default.
clang-format Enforced C++ Coding Style
ITK has adopted a [*.clang-format*](https://github.com/InsightSoftwareConsortium/ITK/blob/master/.clang-format) coding style configuration file so a consistent coding style can automatically be applied to C++ code with the [`clang-format`](http://releases.llvm.org/download.html) binary. A consistent coding style is critical for readability and collaborative development.
`clang-format` has been applied to the entire codebase. The Whitesmiths style of brace indentation, previously part of the [ITK Coding Style Guidelines](https://itk.org/ItkSoftwareGuide.pdf), is not supported by clang-format, so it has been replaced by a brace style consistent with VTK's current style.
A Git commit hook will automatically apply `clang-format` to changed C++ code.
Enhanced Modern C++ Range Support
In addition to the [`ImageBufferRange`](https://itk.org/Doxygen/html/classitk_1_1Experimental_1_1ImageBufferRange.html), [`ShapedImageNeighborhoodRange`](https://itk.org/Doxygen/html/classitk_1_1Experimental_1_1ShapedImageNeighborhoodRange.html), and [`IndexRange`](https://itk.org/Doxygen/html/classitk_1_1Experimental_1_1IndexRange.html) classes introduced in ITK 5.0, ITK 5.1 adds an [`ImageRegionRange`](https://itk.org/Doxygen/html/classitk_1_1Experimental_1_1ImageRegionRange.html). These range classes conform to the Standard C++ Iterator requirements so they can be used in range-based for loop's and passed to Standard C++ algorithms. Range-based for loops provide an elegant syntax for iteration. Moreover, they are often more performant than other iteration classes available.
For example, to add 42 to every pixel:
ImageBufferRange<ImageType> range{ *image };
for (auto&& pixel : range)
{
pixel = pixel + 42;
}
In ITK 5.1, adoption of the range classes was extended across the toolkit, which demonstrates their use and improves toolkit performance.
Point Set Registration Parallelism
ITK provides a powerful registration framework for point-set registration, offering information-theoretic similarity metrics, labeled point-set metrics, and spatial transformation models that range from affine to b-spline to dense displacement fields. ITK 5.1 features enhanced parallelism in point-set metric computation, leveraging the [native thread-pool and Threading Building Blocks (TBB)](https://discourse.itk.org/t/itk-5-0-alpha-2-performance/959) enhancements in ITK 5.
SpatialObject's and Strongly-Typed enum's
Improvements and refinements were made to the ITK 5 `itk::SpatialObject` refactoring, and modern C++ interface. In particular, ITK 5.1 transitions enumerations to [strongly-typed enumerations](https://www.modernescpp.com/index.php/strongly-typed-enums), which is flagged by modern compilers due to improved scoping and implicit conversions to `int`. Enum names now follow a consistent `<Description>Enum` naming conversion, which results in a Python interface:
<Description>Enum_<EnumValue1>
<Description>Enum_<EnumValue2>
[...]
A guide for updating to the new enum's can be found in the [Strongly Typed Enumerations](https://github.com/InsightSoftwareConsortium/ITK/blob/master/Documentation/ITK5MigrationGuide.md#strongly-typed-enumerations) section of the ITK 5 Migration Guide.
DICOM Support
ITK's broadly adopted medical image support is hardened thanks to 20 years of testing and support from major open source DICOM library maintainers. In this release, many members of the community collaborated to further enhance ITK's DICOM support for corner cases related to modality, pixel types, and vendor variations.
Remote Module Updates
New remote module: [TubeTK](https://github.com/InsightSoftwareConsortium/ITKTubeTK): An open-source toolkit, led by Kitware, Inc., for the segmentation, registration, and analysis of tubes and surfaces in images.
A new [remote module grading system](https://discourse.itk.org/t/remote-module-grading-ranking-system-needed/2750) was added to help convey the quality compliance level for the 45 remote modules.
Many remote modules were updated: *AnalyzeObjectMapIO, AnisotropicDiffusionLBR, BSplineGradient, BioCell, BoneEnhancement, BoneMorphometry, Cuberille, FixedPointInverseDisplacementField, GenericLabelInterpolator, HigherOrderAccurateGradient, IOMeshSTL, IOOpenSlide, IOScanco, IOTransformDCMTK, IsotropicWavelets, LabelErodeDilate, LesionSizingToolkit, MinimalPathExtraction, Montage, MorphologicalContourInterpolation, ParabolicMorphology, PhaseSymmetry, RLEImage, RTK, SCIFIO, SimpleITKFilters, SkullStrip, SplitComponents, Strain, SubdivisionQuadEdgeMeshFilter, TextureFeatures, Thickness3D, TotalVariation,* and *TwoProjectionRegistration*.
Zenodo Citation
ITK has a [Zenodo Citation](https://zenodo.org/badge/latestdoi/800928):
[](https://zenodo.org/badge/latestdoi/800928)
This citation can be used to cite a specific version of the software. If you have contributed 10 or more patches to ITK, please add your [ORCID iD](https://orcid.org/) to our [.zenodo.json](https://github.com/InsightSoftwareConsortium/ITK/blob/master/.zenodo.json) file for authorship association.
NumFOCUS Copyright Transfer
ITK's copyright and the copyright of software held by the [Insight Software Consortium](https://www.insightsoftwareconsortium.org/) have been transferred to [NumFOCUS](https://numfocus.org/). [CMake](https://cmake.org)'s copyright has been transferred to [Kitware](https://kitware.com).
And More
Many more improvements have been made. For details, see the changelogs for the release candidates and changelog below.
Congratulations
Congratulations and **thank you** to everyone who contributed to this release.
Of *73 authors* since v5.0.0, we would like to specially recognize the new contributors:
Mathew J. Seng, Zahil Shanis, yjcchen0913, PA Rodesch, Aurélien Coussat, yinkaola, Bryce Besler, Pierre Chatelier, Rinat Mukhometzianov, Ramraj Chandradevan, Hina Shah, Gordian Kabelitz, Genevieve Buckley, Aaron Bray, nslay, Antoine Robert, James Butler, Matthew Rocklin, Gina Helfrich, and Neslisah Torosdagli, Brad T. Moore, Niklas Johansson, Flavien Bridault, Pradeep Garigipati, haaput, tabish, and Antoine Robert, Ben Wilson, Adam Rankin, PA Rodesch, Tabish Syed, vlibertiaux, Michael Jackson, Conrad Poelman, and muschellij2.
**Enjoy ITK!**