=======================
We are happy to announce the release of [Insight Toolkit (ITK)](https://itk.org) 5.2.0! :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, artificial intelligence (AI) libraries, with an emphasis on [Project MONAI](https://monai.io), 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](https://itkpythonpackage.readthedocs.io/en/master/Quick_start_guide.html) and many improvements to the [ITK Sphinx Examples](https://itk.org/ITKExamples/).
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](https://github.com/conda-forge/miniforge).
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 `itk.support.types.ImageLike`.
Many other improvements were made since RC 3 based on community feedback. A full list can be found in the Changelog below.
Downloads
---------
**Python Packages**
Install [ITK Python packages](https://itkpythonpackage.readthedocs.io/en/latest/Quick_start_guide.html) with:
pip install --upgrade itk
**Guide and Textbook**
- [InsightSoftwareGuide-Book1-5.2.0.pdf](https://github.com/InsightSoftwareConsortium/ITK/releases/download/v5.2.0/InsightSoftwareGuide-Book1-5.2.0.pdf)
- [InsightSoftwareGuide-Book2-5.2.0.pdf](https://github.com/InsightSoftwareConsortium/ITK/releases/download/v5.2.0/InsightSoftwareGuide-Book2-5.2.0.pdf)
**Library Sources**
- [InsightToolkit-5.2.0.tar.gz](https://github.com/InsightSoftwareConsortium/ITK/releases/download/v5.2.0/InsightToolkit-5.2.0.tar.gz)
- [InsightToolkit-5.2.0.zip](https://github.com/InsightSoftwareConsortium/ITK/releases/download/v5.2.0/InsightToolkit-5.2.0.zip)
**Testing Data**
Unpack optional testing data in the same directory where the Library Source is unpacked.
- [InsightData-5.2.0.tar.gz](https://github.com/InsightSoftwareConsortium/ITK/releases/download/v5.2.0/InsightData-5.2.0.tar.gz)
- [InsightData-5.2.0.zip](https://github.com/InsightSoftwareConsortium/ITK/releases/download/v5.2.0/InsightData-5.2.0.zip)
**Checksums**
- [MD5SUMS](https://github.com/InsightSoftwareConsortium/ITK/releases/download/v5.2.0/MD5SUMS)
- [SHA512SUMS](https://github.com/InsightSoftwareConsortium/ITK/releases/download/v5.2.0/SHA512SUMS)
Features
--------
MONAI-compatible `itk.Image` metadata dict and NumPy-indexing pixel set/get Python interfaces.
print(image['0008|0008'])
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)
Out[3]:
{'0008|0005': 'ISO IR 100',
'0008|0008': 'ORIGINAL\\PRIMARY\\AXIAL',
'0008|0016': '1.2.840.10008.5.1.4.1.1.2',
'0008|0018': '1.3.12.2.1107.5.8.99.484849.834848.79844848.2001082217554549',
'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]
Out[7]:
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.DataArray`s](https://github.com/InsightSoftwareConsortium/ITK/releases/tag/v5.1.0).
`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](https://vtk.org).
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`](https://github.com/psf/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 `itk.support.*` 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
* KWIML
* KWSys
* MetaIO
* cuFFTW
Remote Module Updates
We added a new [adaptive denoising](https://github.com/ntustison/ITKAdaptiveDenoising) 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%](https://open.cdash.org/index.php?project=Insight) with 127,103 lines tested.
Many more bug fixes and improvements have been made. For details, see the changelog below.
Congratulations
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.