ITK 5.4.8: Concurrent IO, Correct DICOM Geometry, and Sturdier Python Wrapping
We are pleased to announce the release of ITK 5.4.8!
ITK 5.4.8 is a maintenance release for this cross-platform, open-source toolkit for N-dimensional scientific image analysis with spatially-aware algorithms. This release focuses on correctness, concurrency, and compatibility. It removes a MetaIO deadlock that could stall heavily multithreaded reads, fixes DICOM series geometry when slice spacing is negative, and corrects pixel-type, codec, and endianness handling across HDF5, TIFF, and MATLAB IO. On the Python side, BSplineTransform is now wrapped for 2D and 4D, a double-free at interpreter shutdown is fixed, and the Windows wrapping build works with std::unique_ptr arguments again. 🥳
🔦 Highlights
- Concurrency and Image IO:
- MetaImage (
.mha/.mhd) reads no longer call a process-widefflush(nullptr), which could deadlock or stall concurrent reads, especially on macOS. - DICOM series with negative inter-slice spacing, for example when using the series reader’s
ReverseOrderflag, now get the correct direction-cosine sign and keep their physical location. A new GoogleTest suite with more than 800 lines covers series direction handling. HDF5ImageIOnow reports aVECTORpixel type when it infers multiple components, which fixes SimpleITK “Unknown PixelType” errors when reading vector images back.- TIFF
ReadImageInformation()now succeeds for files that use a compression codec ITK was not built with. The error is raised inRead()instead, where decoding actually happens. - VNL’s MATLAB header reader now recognizes native big-endian single-precision files, so
MatlabTransformIOandTxtTransformIOread them correctly on big-endian hosts.
- MetaImage (
- Transforms:
AzimuthElevationToCartesianTransform::IsLinear()now returnsfalse, so code no longer reduces this nonlinear transform to an incorrect matrix and offset.- Python
dict_from_transformnow recurses into nestedCompositeTransformchildren, so their transforms are no longer dropped. - A possible undefined-behavior case in
Transform::ApplyToImageMetadatais fixed.
- Python Wrapping:
BSplineTransformis now wrapped for the 2D→2D and 4D→4D cases.GradientImageFilter::OverrideBoundaryConditionandOptimizerParameters::SetHelpernow transfer ownership correctly, which removes a double-free at interpreter shutdown.- MSVC builds now pass
/Zc:__cpluspluswhen compiling SWIG wrappers, which restoresstd::movesupport for wrapped methods that takestd::unique_ptrarguments.
- Build and Platform Support:
- VtkGlue builds against VTK 9.7 and later with
VTK_USE_FUTURE_CONST. - Mangled libpng ARM NEON filter-row symbols prevent symbol clashes on ARM.
- Module Doxygen cross-references use
@ref, which silences the CMake 4.4CMP0219policy warning. - The
ObjectFactoryautoload entry-point name is now configurable throughITK_LOAD_FUNCTION_NAME, which supports builds that rename ITK’s symbols. - Remote-module pins were updated toward convergence with
main, and release-5.4 stays buildable for SimpleITK.
- VtkGlue builds against VTK 9.7 and later with
- Reliability:
- Non-const image iterators now call the non-const
GetBufferPointer(), so image types such asCudaImageare notified of writes. - Six registration and overlap tests now return their helper’s status. Previously they always returned success and hid 13 failure returns and 31
ITK_TEST_*assertions. - Repository safety-net pre-commit hooks are now enabled on release-5.4, along with cleanup of whitespace, end-of-file newlines, and Python shebangs.
- Non-const image iterators now call the non-const
🧵 Faster, Deadlock-Free Concurrent MetaIO Reads
MetaObject::ReadStream() and MetaForm::ReadStream() called fflush(nullptr) before parsing. This was left over from the original MetaIO code and predates multithreading. fflush(NULL) flushes every open FILE* stream in the process, and on platforms such as macOS it locks each stream in turn. When many threads opened and read their own MetaImage files, these global flushes competed for every other thread’s file handles. Concurrent reads could then slow to a halt indefinitely.
Reading does not require flushing previously written data, so ITK 5.4.8 removes the call. Applications that load many MetaImage files in parallel, such as data loaders for deep-learning training, should see reliable concurrent throughput.
🧭 Correct DICOM Series Geometry with Negative Spacing
When the spacing between DICOM slices was negative, the direction-cosine matrix had the wrong sign along the slice axis. This was easy to trigger with the series reader’s ReverseOrder flag. ITK 5.4.8 corrects the sign, so a DICOM series keeps its correct physical location whatever the slice order. A new regression suite, itkGDCMSeriesDirectionGTest, exercises a wide range of series orientations and orderings to guard against future regressions.
🐍 More Robust Python Wrapping
itk.BSplineTransformnow offers[double, 2, 3]and[double, 4, 3]alongside the existing 3D instantiation, which enables Python B-spline registration workflows for 2D and 4D images.- Two methods store their raw-pointer argument in a
std::unique_ptrmember, but Python kept ownership too, so both sides freed the object. These methods now use SWIGDISOWNsemantics, and new Python regression tests cover them. - MSVC reports
__cplusplusas199711Lunless/Zc:__cplusplusis set, which made SWIG quietly turnstd::move(x)into a copy. With the flag set on wrapper sources only, the Windows Python wrapping build compiles again, and ITK’s own build flags are unchanged.