%global _lto_cflags %{nil} # Use 'define' not 'global' for debug_package: EPEL 9 auto-injects the # debuginfo stanza during spec parsing and 'global' scope causes a conflict. %define debug_package %{nil} # ITK's own Python wrapping (ITK_WRAP_PYTHON), off by default. # # This is NOT SimpleITK. python3-simpleitk is a separate upstream project with a # simplified, non-templated procedural API; code written for one does not run on # the other. monai-physio, python3-trame-slicer and SlicerOpenLIFU want `import # itk` -- the full templated API -- and nothing in this repo provides it. # # Off by default because it is expensive, not because it is optional. Enable with: # copr-cli build ... --with python_wrapping (or rpmbuild --with) # Reference points for the cost: ITK core alone builds in ~6 minutes on a COPR # builder (11034910), while SimpleITK -- which wraps a SUBSET of ITK with a # simplified API -- takes 6.8 hours (11032535) and needed --timeout 36000. Full # templated wrapping instantiates across every pixel type x dimension, so expect # it to exceed SimpleITK rather than approach it. Measure before assuming it fits # inside a COPR build timeout. %bcond_with python_wrapping Name: InsightToolkit5 Version: 5.4.7 Release: 11%{?dist} Summary: Insight Segmentation and Registration Toolkit (ITK) v5 # Licenses of everything shipped, bundled code included. Derived from the # libraries our own build installs (rpm -qpl of 5.4.7-4), following the # accounting Ankur Sinha added to Fedora's InsightToolkit (84675f7): # Apache-2.0 ITK core # BSD-3-Clause DICOMParser (Copyright.txt), KWSys/itksys (Copyright.txt), # MetaIO (License.txt) # BSD-2-Clause OpenJPEG (LICENSE) # MIT libLBFGS (lbfgs.h header) # Zlib NrrdIO (source headers; no separate licence file) # LicenseRef-Fedora-Public-Domain # GIFTI (LICENSE.gifti), NIFTI + znz (LICENSE), # Netlib/SLATEC (public domain via netlib.org) # Eigen3, DoubleConversion and VXL are system libraries now, so their licences # are carried by eigen3-devel, double-conversion and vxl, not here. License: Apache-2.0 AND BSD-3-Clause AND BSD-2-Clause AND MIT AND Zlib AND LicenseRef-Fedora-Public-Domain URL: https://itk.org/ Source0: https://github.com/InsightSoftwareConsortium/ITK/releases/download/v%{version}/InsightToolkit-%{version}.tar.gz # ITK remote module required by ANTs (pinned commit from ITK 5.4.5's GenericLabelInterpolator.remote.cmake) %global glinterp_commit ebf2436469ccf82c08fab54b7446f699ad0eae01 Source1: https://github.com/InsightSoftwareConsortium/ITKGenericLabelInterpolator/archive/%{glinterp_commit}/ITKGenericLabelInterpolator-%{glinterp_commit}.tar.gz # AdaptiveDenoising remote module: provides itkAdaptiveNonLocalMeansDenoisingImageFilter.h # required by ANTs 2.6.5 DenoiseImage and antsJointFusion %global adaptive_commit 24825c8d246e941334f47968553f0ae388851f0c Source2: https://github.com/ntustison/ITKAdaptiveDenoising/archive/%{adaptive_commit}/ITKAdaptiveDenoising-%{adaptive_commit}.tar.gz # MorphologicalContourInterpolation remote module: required by ITK-SNAP 4.x # (pinned commit from ITK 5.4.5's MorphologicalContourInterpolation.remote.cmake) %global morphci_commit 821bf9b3ef8eaaab10391ed060dc9ca5e4d37b39 Source3: https://github.com/KitwareMedical/ITKMorphologicalContourInterpolation/archive/%{morphci_commit}/ITKMorphologicalContourInterpolation-%{morphci_commit}.tar.gz # GrowCut remote module: provides itkFastGrowCut.h required by MITK Segmentation %global growcut_commit cbf93ab65117abfbf5798745117e34f22ff04728 Source4: https://github.com/InsightSoftwareConsortium/ITKGrowCut/archive/%{growcut_commit}/ITKGrowCut-%{growcut_commit}.tar.gz # SimpleITKFilters remote module: required by SimpleITK %global sitkfilters_commit bb896868fc6480835495d0da4356d5db009592a6 Source5: https://github.com/InsightSoftwareConsortium/ITKSimpleITKFilters/archive/%{sitkfilters_commit}/ITKSimpleITKFilters-%{sitkfilters_commit}.tar.gz # LabelErodeDilate remote module: required by SimpleITK %global labelerodedilate_commit 22d8846dbe4368312aa3aa95ecfe3542ab894e15 Source6: https://github.com/InsightSoftwareConsortium/ITKLabelErodeDilate/archive/%{labelerodedilate_commit}/ITKLabelErodeDilate-%{labelerodedilate_commit}.tar.gz # MGHIO remote module: 3D Slicer needs MGH/MGZ (Freesurfer) image format I/O # (pinned commit from ITK 5.4.6's MGHIO.remote.cmake) %global mghio_commit 0adac35fa22945c7a5f3a63dd8d01454577c24d3 Source7: https://github.com/InsightSoftwareConsortium/itkMGHImageIO/archive/%{mghio_commit}/itkMGHImageIO-0adac35f.tar.gz # IOScanco remote module: 3D Slicer needs Scanco microCT .isq image I/O # (pinned commit from ITK 5.4.6's IOScanco.remote.cmake) %global ioscanco_commit 10b80f69048e79ab3069e89635822a6851099278 Source8: https://github.com/KitwareMedical/ITKIOScanco/archive/%{ioscanco_commit}/ITKIOScanco-10b80f69.tar.gz # ITK 5.4.7 carries the NRRD AxesReorder / 5D I/O API and the ImageFileReader # short-axis crash fix that we used to backport as Patch0 and Patch1 for # 3D Slicer's vtkITKImageSequenceReader. Both are upstream now, so the # backports are gone. # https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval ExcludeArch: %{ix86} BuildRequires: gcc-c++ %if %{with python_wrapping} # ITK_WRAP_PYTHON drives castxml to parse the headers and swig to emit the # bindings. Both are packaged in Fedora, which is why this is a compute question # rather than a prerequisites one. BuildRequires: castxml BuildRequires: swig BuildRequires: python3-devel BuildRequires: python3-numpy # For stripping build-tree RUNPATHs off the wrapped extension modules; see %%install. BuildRequires: chrpath %endif BuildRequires: cmake >= 3.16 BuildRequires: fftw-devel BuildRequires: expat-devel BuildRequires: libtiff-devel BuildRequires: libjpeg-devel BuildRequires: libpng-devel BuildRequires: zlib-devel %if 0%{?fedora} BuildRequires: libminc-devel BuildRequires: eigen3-devel BuildRequires: double-conversion-devel BuildRequires: vxl-devel %endif BuildRequires: hdf5-devel BuildRequires: gdcm-devel BuildRequires: dcmtk-devel BuildRequires: openjpeg2-devel # System VTK for ITKVtkGlue BuildRequires: vtk-devel BuildRequires: python3-devel # Transitive deps of VTK's cmake config (find_package calls in # VTK-vtk-module-find-packages.cmake); should be Requires of vtk-devel BuildRequires: json-devel BuildRequires: utf8cpp-devel BuildRequires: PEGTL-devel BuildRequires: fmt-devel BuildRequires: lz4-devel BuildRequires: xz-devel BuildRequires: libogg-devel BuildRequires: libtheora-devel BuildRequires: sqlite-devel BuildRequires: libharu-devel BuildRequires: proj-devel BuildRequires: pugixml-devel BuildRequires: jsoncpp-devel BuildRequires: freetype-devel BuildRequires: libxml2-devel BuildRequires: double-conversion-devel # VTK 9.6.2 added CLI11 as a module dependency; its cmake config # find_package(CLI11)s at configure time, so any find_package(VTK) consumer # (here: Modules/Bridge/VtkGlue) now needs CLI11 present in the buildroot. BuildRequires: cli11-devel BuildRequires: cmake(Qt6) BuildRequires: cmake(Qt6Quick) BuildRequires: cmake(Qt6OpenGL) BuildRequires: cmake(Qt6OpenGLWidgets) BuildConflicts: InsightToolkit-devel # From Fedora's InsightToolkit (Ankur Sinha, 0001-remove-vxl-netlib.patch). # With ITK_USE_SYSTEM_VXL=ON, ITK links both v3p_netlib and a stray "netlib" # that system VXL does not ship -- Fedora's vxl provides only # libv3p_netlib.so. Without this, the build dies at link with # "cannot find -lnetlib" (our COPR 10990784). Applies unchanged to 5.4.7. Patch0: InsightToolkit5-remove-vxl-netlib.patch # System-library mode drops include dirs that bundled mode provided for free, # because bundled Eigen, VXL and double-conversion installed under ITK's own # include dir. Export them: Eigen and double-conversion into the module # include dirs (${ITK_INCLUDE_DIRS} consumers: charm-gems, elastix), VXL onto # the ITKVNLInstantiation target (target consumers: mitk). Upstream ITK main # has the same gaps; not yet reported. Patch1: InsightToolkit5-export-system-include-dirs.patch # Lets the packager append flags to the castxml parse only. castxml embeds its own # Clang, and Fedora 44's castxml 0.7.0 carries a Clang older than the gcc 16.2.1 # whose libstdc++ it has to read, so ITK_WRAP_PYTHON dies at the FIRST castxml # invocation while the real compilation is fine. Two parse errors, both parse-only: # libstdc++ 16's uses explicit object parameters (Clang wants C++23), # and Eigen 5.0.1 takes its GCC-strict SSE path because --castxml-cc-gnu makes # Clang claim to be GCC, then calls __builtin_ia32_sqrtsd, which Clang lacks. # Measured by fsk-dual on f44: c++17 and c++20 both fail, c++23 parses libstdc++, # c++23 + EIGEN_DONT_VECTORIZE parses Eigen too. The flags are appended last so # they beat the -std= derived from CMAKE_CXX_STANDARD, which leaves the standard # the library is COMPILED with untouched. Empty by default. Not yet reported # upstream, which does not hit this because it downloads a prebuilt castxml with a # matched Clang -- the same reason this will recur whenever gcc or eigen moves # ahead of Fedora's castxml. Patch2: InsightToolkit5-castxml-extra-flags.patch # ITK 5.x is not fully compatible with ITK 4.x, so we package it separately. # We use ITK's versioned install paths to allow side-by-side installation. # Unbundling, converged with Fedora's InsightToolkit (Ankur Sinha) 2026-09-15. # # Eigen3, DoubleConversion and VXL are now taken from the system. The previous # note here claimed eigen3 5.0.1 broke "ITK's find_package(Eigen3 3.3)" — ITK # makes no such call. Modules/ThirdParty/Eigen3/CMakeLists.txt does a versionless # find_package(Eigen3 REQUIRED CONFIG) and then an `if(VERSION_LESS 3.3)` check, # which 5.0.1 passes. Fedora has built ITK with ITK_USE_SYSTEM_EIGEN=ON against # eigen3 5.0.1 since 2026-08-10. # # ITK_USE_SYSTEM_LIBRARIES is only the *default* for each individual option # (`option(ITK_USE_SYSTEM_EIGEN ... ${ITK_USE_SYSTEM_LIBRARIES})`), so the # explicit per-library flags below win regardless of it. # # Still bundled, and why — ITK offers no system option for these: # NIFTI no ITK_USE_SYSTEM_NIFTI option (bundled nifti_clib) # OpenJPEG no ITK_USE_SYSTEM_OPENJPEG option; ITK bundles OpenJPEG 1.x. # We used to pass -DITK_USE_SYSTEM_OPENJPEG=ON, which CMake # silently ignored — it was always a no-op. # MetaIO, KWSys, NrrdIO, Netlib, DICOMParser, GIFTI, VNLInstantiation # not packaged in Fedora # # VXL is unbundled too, via Patch0 below. Our first attempt failed at link on # "cannot find -lnetlib"; the cause was not our module set but a stray # "netlib" in ITK's own link lines, which Fedora's spec already patches out. # Bundled third-party code, declared per Fedora's bundling policy. Merged from # Fedora's own InsightToolkit.spec (Ankur Sinha), which carried 11 of these to # our 4 -- every one of them is a library ITK vendors and offers no working # system option for, so they ship inside our rpm whether or not we name them. # Versions corroborated against the ITK source tree where the code carries one # (NrrdIO 1.11.1, OpenJPEG 1.2.0, liblbfgs 1.10, googletest 1.13.0); gifticlib # and nifti are taken from Fedora's spec, whose maintainer researched them. # Re-check these on every ITK version bump -- a bundled version can move without # the ITK version telling you. Provides: bundled(DICOMParser) Provides: bundled(gifticlib) = 1.16 Provides: bundled(googletest) = 1.13.0 Provides: bundled(kwsys) Provides: bundled(liblbfgs) = 1.10 Provides: bundled(metaio) Provides: bundled(netlib) Provides: bundled(nifti) = 2.1.0 Provides: bundled(NrrdIO) = 1.11.1 Provides: bundled(openjpeg) = 1.2.0 Provides: bundled(VNLInstantiation) # Pin the exact VTK ABI this package was built against. VTK freezes its soname at # libvtk*.so.1 across all of 9.x, so rpm cannot tell 9.5 from 9.6 from 9.7: a consumer # built against one installs cleanly against another and fails at LOAD with undefined # symbols. A >= floor does not help -- 9.7.0 satisfies >= 9.6.2 -- so this is an exact # match. %%vtk_abi comes from vtk-devel's macros.vtk, so it re-pins on every rebuild. # # The missing-macro check lives in %%build, deliberately, NOT at parse time. A # parse-time %%error cannot distinguish "COPR is generating the SRPM" from "this is a # real buildroot": rpkg srpm parses the spec with no buildroot and therefore no # vtk-devel, so a parse-time guard killed every SCM build of every guarded package # before any chroot existed (python-simpleitk 10980296 failed in 0 minutes with # "can't parse specfile"). Expanding to UNSET keeps the SRPM parse alive, and the # %%build test still fails loudly in a buildroot lacking vtk-devel, so no RPM carrying # the placeholder can ever be produced. Requires: vtk(abi) = %{?vtk_abi}%{!?vtk_abi:UNSET} %description The Insight Toolkit (ITK) is an open-source, cross-platform system that provides developers with an extensive suite of software tools for image analysis. This package provides version 5 of the toolkit. %package devel Summary: Development files for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} Requires: %{name}-vtk-devel%{?_isa} = %{version}-%{release} # Transitive cmake find_package deps: downstream consumers of ITK's UseITK.cmake # will have find_package() called for each system library ITK was built against. Requires: fftw-devel Requires: hdf5-devel Requires: expat-devel Requires: libjpeg-devel Requires: libpng-devel Requires: libtiff-devel Requires: zlib-devel Requires: gdcm-devel Requires: dcmtk-devel Requires: openjpeg2-devel %if 0%{?fedora} Requires: libminc-devel %endif # Unbundled since -4/-5, and still part of ITK's public build interface: # ITKEigen3.cmake calls find_package(Eigen3 REQUIRED CONFIG), and # ITKVNL_INCLUDE_DIRS points at /usr/include/vxl, whose headers ITK's public # headers include (itkVector.h -> vnl/vnl_vector_ref.h). double-conversion's # headers are exported too (Patch1), matching the flat layout bundled ITK # installed; elastix includes "double-conversion.h" directly. Requires: eigen3-devel Requires: vxl-devel%{?_isa} Requires: double-conversion-devel%{?_isa} %description devel The %{name}-devel package contains libraries and header files for developing applications that use %{name}. %package vtk Summary: Provides an interface between ITK and VTK Requires: %{name}%{?_isa} = %{version}-%{release} %description vtk Provides an interface between ITK and VTK. %package vtk-devel Summary: Development files for the ITK-VTK bridge Requires: %{name}-vtk%{?_isa} = %{version}-%{release} Requires: vtk-devel%{?_isa} %description vtk-devel Libraries and header files for developing applications that use the ITK-VTK bridge (ITKVtkGlue). %package doc Summary: Documentation for %{name} BuildArch: noarch %description doc Documentation, copyright notices, and the ITK Software Guide references for version 5 of the Insight Toolkit. %package examples Summary: Example programs and data for %{name} BuildArch: noarch Requires: %{name}-devel = %{version}-%{release} %description examples Example source code, CMakeLists.txt, and test data for building applications with ITK 5. Useful as starting points for new projects. %prep %autosetup -p1 -n InsightToolkit-%{version} # Unpack the GenericLabelInterpolator remote module into the expected location. # ITK's Module_GenericLabelInterpolator=ON normally fetches this at cmake time; we # pre-populate the source directory so the build works offline (mock/COPR policy). mkdir -p Modules/Remote/GenericLabelInterpolator tar -xzf %{SOURCE1} --strip-components=1 \ -C Modules/Remote/GenericLabelInterpolator mkdir -p Modules/Remote/AdaptiveDenoising tar -xzf %{SOURCE2} --strip-components=1 \ -C Modules/Remote/AdaptiveDenoising mkdir -p Modules/Remote/MorphologicalContourInterpolation tar -xzf %{SOURCE3} --strip-components=1 \ -C Modules/Remote/MorphologicalContourInterpolation mkdir -p Modules/Remote/GrowCut tar -xzf %{SOURCE4} --strip-components=1 \ -C Modules/Remote/GrowCut mkdir -p Modules/Remote/SimpleITKFilters tar -xzf %{SOURCE5} --strip-components=1 \ -C Modules/Remote/SimpleITKFilters mkdir -p Modules/Remote/LabelErodeDilate tar -xzf %{SOURCE6} --strip-components=1 \ -C Modules/Remote/LabelErodeDilate mkdir -p Modules/Remote/MGHIO tar -xzf %{SOURCE7} --strip-components=1 \ -C Modules/Remote/MGHIO mkdir -p Modules/Remote/IOScanco tar -xzf %{SOURCE8} --strip-components=1 \ -C Modules/Remote/IOScanco %build # vtk_abi comes from vtk-devel's macros.vtk. Absent means BuildRequires: vtk-devel is # missing, and the Requires above would ship as the vacuous "vtk(abi) = UNSET". test -n "%{?vtk_abi}" || { echo "ERROR: vtk_abi undefined - add 'BuildRequires: vtk-devel'" >&2; exit 1; } # Relax compiler checks for compatibility with GCC 14+ and force local include # path to avoid system header conflicts export CXXFLAGS="%{optflags} -fpermissive -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -D_GNU_SOURCE -I%{_builddir}/InsightToolkit-%{version}/Modules/Core/Common/include" # FFTW (ITK_USE_FFTWD/F) is ON, matching Fedora's InsightToolkit. ITK_USE_SYSTEM_FFTW # alone does nothing. FFTW is GPL-2.0-or-later; ITK's own configure warns that # the ITK libraries built this way, and every executable linked against them, # are covered by the GPL. This is a deliberate choice (Morgan Hough, # 2026-09-17), documented in docs/licensing/itk-fftw-gpl.md. The License: tag # is unchanged because it describes this package's sources, and FFTW is not # bundled. %cmake \ -DCMAKE_CXX_STANDARD:STRING=17 \ -DBUILD_EXAMPLES:BOOL=OFF \ -DBUILD_TESTING:BOOL=OFF \ -DBUILD_SHARED_LIBS:BOOL=ON \ -DITK_BUILD_DEFAULT_MODULES:BOOL=ON \ -DITK_USE_SYSTEM_LIBRARIES:BOOL=OFF \ -DITK_USE_SYSTEM_EIGEN:BOOL=ON \ -DITK_USE_SYSTEM_EXPAT:BOOL=ON \ -DITK_USE_SYSTEM_FFTW:BOOL=ON \ -DITK_USE_FFTWD:BOOL=ON \ -DITK_USE_FFTWF:BOOL=ON \ -DITK_USE_SYSTEM_HDF5:BOOL=ON \ -DITK_USE_SYSTEM_JPEG:BOOL=ON \ -DITK_USE_SYSTEM_PNG:BOOL=ON \ -DITK_USE_SYSTEM_TIFF:BOOL=ON \ -DITK_USE_SYSTEM_ZLIB:BOOL=ON \ -DITK_USE_SYSTEM_GDCM:BOOL=ON \ -DITK_USE_SYSTEM_DCMTK:BOOL=ON \ -DITK_USE_SYSTEM_DOUBLECONVERSION:BOOL=ON \ -DITK_USE_SYSTEM_VXL:BOOL=ON \ -DModule_ITKGoogleTest:BOOL=OFF \ -DModule_GenericLabelInterpolator:BOOL=ON \ -DModule_AdaptiveDenoising:BOOL=ON \ -DModule_MorphologicalContourInterpolation:BOOL=ON \ -DModule_GrowCut:BOOL=ON \ -DModule_SimpleITKFilters:BOOL=ON \ -DModule_LabelErodeDilate:BOOL=ON \ -DModule_ITKVtkGlue:BOOL=ON \ -DModule_ITKIOPhilipsREC:BOOL=ON \ -DModule_ITKReview:BOOL=ON \ -DModule_ITKDeprecated:BOOL=ON \ %if %{with python_wrapping} -DITK_WRAP_PYTHON:BOOL=ON \ -DITK_LEGACY_SILENT:BOOL=ON \ `# ITK_USE_SYSTEM_CASTXML and ITK_USE_SYSTEM_SWIG both default to OFF, so` \ `# ITK_WRAP_PYTHON alone adds ExternalProjects that DOWNLOAD a prebuilt` \ `# castxml tarball and build their own swig and PCRE. COPR 11039472 died in` \ `# 3 minutes on that download. Worse than a failure locally: a workstation` \ `# mock HAS network, so the download succeeds and the build looks correct` \ `# while wrapping against an upstream prebuilt BINARY castxml 0.6.5 instead` \ `# of Fedora's 0.7.0 -- unshippable, and any timing measured that way is the` \ `# timing of the wrong toolchain. pygccxml, the third generator input, needs` \ `# nothing: ITK bundles it under Modules/ThirdParty/pygccxml/src.` \ -DITK_USE_SYSTEM_CASTXML:BOOL=ON \ -DCASTXML_EXECUTABLE:FILEPATH=%{_bindir}/castxml \ -DITK_USE_SYSTEM_SWIG:BOOL=ON \ -DSWIG_EXECUTABLE:FILEPATH=%{_bindir}/swig \ `# Enabled by Patch2; see the patch comment for the measurement.` \ -DITK_WRAP_CASTXML_EXTRA_FLAGS:STRING="-std=c++23 -DEIGEN_DONT_VECTORIZE" \ %endif `# 3D Slicer's Libs/ITKFactoryRegistration requires MGHIO + IOScanco +` \ `# ITKIOTransformMatlab + ITKIODCMTK. MGHIO and IOScanco are REMOTE` \ `# modules (sources pre-staged in %prep from Source7/Source8).` \ `# ITKIOTransformMatlab and ITKIODCMTK are built-in but EXCLUDE_FROM_DEFAULT.` \ -DModule_MGHIO:BOOL=ON \ -DModule_IOScanco:BOOL=ON \ -DModule_ITKIOTransformMatlab:BOOL=ON \ -DModule_ITKIODCMTK:BOOL=ON \ -DITK_FORBID_DOWNLOADS:BOOL=ON \ %if 0%{?fedora} -DITK_USE_SYSTEM_MINC:BOOL=ON \ %else -DITK_USE_SYSTEM_MINC:BOOL=OFF \ %endif -DITK_INSTALL_PACKAGE_SUFFIX:STRING=-5.4 \ -DITK_INSTALL_LIBRARY_DIR:PATH=%{_lib} \ -DITK_INSTALL_INCLUDE_DIR:PATH=include/ITK-5.4 \ -DITK_SKIP_PATH_LENGTH_CHECKS:BOOL=ON %cmake_build %install %cmake_install # Move bundled docs to doc subpackage location mkdir -p %{buildroot}%{_docdir}/%{name}-doc if [ -d %{buildroot}%{_datadir}/doc/ITK-5.4 ]; then mv %{buildroot}%{_datadir}/doc/ITK-5.4/* %{buildroot}%{_docdir}/%{name}-doc/ 2>/dev/null || true rm -rf %{buildroot}%{_datadir}/doc/ITK-5.4 fi # Install examples for downstream developers mkdir -p %{buildroot}%{_datadir}/%{name}/examples cp -a Examples/* %{buildroot}%{_datadir}/%{name}/examples/ 2>/dev/null || true # Remove zero-length stub headers (rpmlint zero-length error; ITK uses them as placeholders) find %{buildroot}%{_includedir} -name stub.h -empty -delete # Remove cmake configs for ITK's internal bundled MINC library (installed to lib64/cmake/ # when ITK_USE_SYSTEM_MINC=OFF on EPEL; directory does not exist on Fedora) if [ -d %{buildroot}%{_libdir}/cmake ]; then find %{buildroot}%{_libdir}/cmake -maxdepth 1 \ \( -name 'itkLIBMINC*.cmake' -o -name 'UseitkLIBMINC.cmake' \) -delete fi # Bundled licence texts, renamed to avoid collisions (after 84675f7 in Fedora's # InsightToolkit). NrrdIO has no separate file: its Zlib notice is in the source # headers. NIFTI's LICENSE is installed here too, which Fedora's spec does not. install -d %{buildroot}%{_defaultlicensedir}/%{name} install -pm 0644 Modules/ThirdParty/DICOMParser/src/DICOMParser/Copyright.txt \ %{buildroot}%{_defaultlicensedir}/%{name}/LICENSE.dicomparser install -pm 0644 Modules/ThirdParty/GIFTI/src/gifticlib/LICENSE.gifti \ %{buildroot}%{_defaultlicensedir}/%{name}/LICENSE.gifti install -pm 0644 Modules/ThirdParty/KWSys/src/KWSys/Copyright.txt \ %{buildroot}%{_defaultlicensedir}/%{name}/LICENSE.kwsys install -pm 0644 Modules/ThirdParty/MetaIO/src/MetaIO/License.txt \ %{buildroot}%{_defaultlicensedir}/%{name}/LICENSE.metaio install -pm 0644 Modules/ThirdParty/NIFTI/src/nifti/LICENSE \ %{buildroot}%{_defaultlicensedir}/%{name}/LICENSE.nifti install -pm 0644 Modules/ThirdParty/OpenJPEG/src/LICENSE \ %{buildroot}%{_defaultlicensedir}/%{name}/LICENSE.openjpeg %if %{with python_wrapping} # ITK_WRAP_PYTHON copies the whole ITK runtime into the Python package, every copy # linked against the build tree. check-rpaths rejected 79 distinct files in COPR # 11039490 -- 78 shared libraries plus a duplicate itkTestDriver -- each carrying # /builddir/.../Wrapping/Generators/Python/itk in its RUNPATH and an empty entry # besides. That is what ended a build whose 3643 targets had all compiled, and it # is a %%install failure, so it costs the full two hours before it shows. # # The 78 libraries are redundant, not merely unshippable: every one matches a # libITK*/libitk* glob the main package already owns, and python3-itk requires # InsightToolkit5 = %%{version}-%%{release}, so the real ones are always present. # Delete the copies and strip the extension modules in place. ITKPyBase and # ITKPyUtils survive this -- they exist only as _ITK*Python.abi3.so, never as # lib*.so.1. Counted and verified by fsk-dual against 11039490's log. rm -f %{buildroot}%{python3_sitearch}/itk/libITK*.so.1 \ %{buildroot}%{python3_sitearch}/itk/libitk*.so.1 \ %{buildroot}%{python3_sitearch}/itk/itkTestDriver find %{buildroot}%{python3_sitearch}/itk -name '*.so' -print0 \ | xargs -0 -r chrpath -d 2>/dev/null || : # Print the top-level site-packages manifest while we still can. check-rpaths and # check-files both run after %%install, so a failure in either aborts before rpm # ever lists what was installed -- and each round trip here is two hours. This # makes the log answer "what does ITK_WRAP_PYTHON actually install?" even when the # build dies. echo "=== python3-itk install manifest (site-packages, depth 1) ===" find %{buildroot}%{python3_sitearch} -maxdepth 1 -mindepth 1 | \ sed "s|%{buildroot}||" | LC_ALL=C sort echo "=== end manifest ===" %endif %ldconfig_scriptlets %ldconfig_scriptlets vtk # Ship %itk_ver so a consumer can pin the ITK it was actually BUILT against. # # Why this is needed: ITK freezes its sonames across releases -- libITKFFT-5.4.so.1 # is identical in name in 5.4.7-2 and 5.4.7-8 -- while ADDING symbols. 5.4.7-8 # enabled FFTW, which exports # _ZN3itk46FFTWFFTImageFilterInitFactoryRegister__PrivateEv. rpm generates # dependencies from sonames, so it cannot tell the two apart: a consumer built # against -8 installs cleanly over -2 and then dies at exit 127 on every # invocation. c3d does exactly this, measured on a real host. # # A FLOOR, not an abi equality like vtk(abi): the soname is stable and the # breakage is additive, so a NEWER ITK is always fine and only an older one is # the problem. An equality would force every consumer to rebuild on every ITK # release for no benefit. # # Consumers take: # Requires: InsightToolkit5%%{?_isa} >= %%{?itk_ver}%%{!?itk_ver:UNSET} # plus a %%build guard, because ">= UNSET" is SATISFIED -- rpm ranks a numeric # segment above an alphabetic one, so an undefined macro fails OPEN and the floor # silently disappears. The guard is what makes the floor safe. mkdir -p %{buildroot}%{_rpmmacrodir} cat > %{buildroot}%{_rpmmacrodir}/macros.itk <<'EOF' %%itk_ver %{version}-%{release} EOF %if %{with python_wrapping} %package -n python3-itk Summary: Python bindings for the Insight Toolkit Requires: %{name}%{?_isa} = %{version}-%{release} Requires: python3-numpy %description -n python3-itk ITK's own Python wrapping: the full templated ITK API exposed through SWIG. This is distinct from python3-simpleitk, which is a separate upstream project offering a simplified procedural interface. Code written against one will not run against the other. %endif %files %license LICENSE %license %{_defaultlicensedir}/%{name}/LICENSE.dicomparser %license %{_defaultlicensedir}/%{name}/LICENSE.gifti %license %{_defaultlicensedir}/%{name}/LICENSE.kwsys %license %{_defaultlicensedir}/%{name}/LICENSE.metaio %license %{_defaultlicensedir}/%{name}/LICENSE.nifti %license %{_defaultlicensedir}/%{name}/LICENSE.openjpeg %doc NOTICE README.md %{_libdir}/libITK*.so.1 %{_libdir}/libitk*.so.1 %exclude %{_libdir}/libITKVtkGlue*.so.1 %files devel %{_rpmmacrodir}/macros.itk %{_includedir}/ITK-5.4/ %exclude %{_includedir}/ITK-5.4/itkImageToVTKImageFilter.h* %exclude %{_includedir}/ITK-5.4/itkVTKImageToImageFilter.h* %exclude %{_includedir}/ITK-5.4/QuickView.h %exclude %{_includedir}/ITK-5.4/vtkCaptureScreen.h %{_prefix}/lib/cmake/ITK*/ %exclude %{_prefix}/lib/cmake/ITK-5.4/Modules/ITKVtkGlue.cmake %{_libdir}/libITK*.so %{_libdir}/libitk*.so %exclude %{_libdir}/libITKVtkGlue*.so %{_bindir}/itkTestDriver %files vtk %{_libdir}/libITKVtkGlue*.so.1 %files vtk-devel %{_libdir}/libITKVtkGlue*.so %{_includedir}/ITK-5.4/itkImageToVTKImageFilter.h* %{_includedir}/ITK-5.4/itkVTKImageToImageFilter.h* %{_includedir}/ITK-5.4/QuickView.h %{_includedir}/ITK-5.4/vtkCaptureScreen.h %{_prefix}/lib/cmake/ITK-5.4/Modules/ITKVtkGlue.cmake %files doc %{_docdir}/%{name}-doc/ %files examples %{_datadir}/%{name}/examples/ %if %{with python_wrapping} %files -n python3-itk # ITK_WRAP_PYTHON installs exactly two things at the site-packages root: itk/ and # itkConfig.py. A bare %%{python3_sitearch}/itk* glob looks like it covers both and # does not -- byte-compiling a ROOT-level module puts its bytecode in # %%{python3_sitearch}/__pycache__/, and a glob anchored on "itk" cannot match a # path beginning "__pycache__". One unpackaged .pyc would fail check-files, which # runs after check-rpaths, i.e. only once the two-hour compile is already spent. # %%pycached owns the bytecode without claiming the shared __pycache__ directory, # which other packages co-own. Caught statically by fsk-dual before it cost a # build. The %%install manifest above is the standing check on the claim. %{python3_sitearch}/itk/ %pycached %{python3_sitearch}/itkConfig.py %endif %changelog * Sat Sep 26 2026 Morgan Hough - 5.4.7-11 - python_wrapping is now buildable from git alone. -10 fixed 1 of the 79 files check-rpaths rejected and carried none of the toolchain work, so a build from main died in 3 minutes. Six changes, all measured by fsk-dual on COPR: * Patch2 adds ITK_WRAP_CASTXML_EXTRA_FLAGS. castxml embeds its own Clang, and Fedora 44's castxml 0.7.0 cannot parse gcc 16's libstdc++ (explicit object parameters need C++23) or eigen 5.0.1 (its GCC-only SSE path calls a builtin Clang lacks). Parse-time only; the compiled library keeps its own standard. * ITK_USE_SYSTEM_CASTXML + ITK_USE_SYSTEM_SWIG, with explicit executables. Both default OFF, so ITK_WRAP_PYTHON downloads a prebuilt castxml and builds its own swig -- 3 minutes to failure on a COPR builder (11039472), and worse on a workstation, where the download SUCCEEDS and silently wraps against an unshippable prebuilt binary toolchain. * The wrapping copies 78 ITK shared libraries into sitearch with build-tree RUNPATHs. All 78 duplicate libraries the main package already owns, and python3-itk requires it by exact NVR, so they are deleted and the remaining extension modules get chrpath -d. * %%pycached %%{python3_sitearch}/itkConfig.py. itk* does not match the root-level module's bytecode, which lands in %%{python3_sitearch}/__pycache__. - Whether "import itk" works is still open; the build proves files, not imports. * Sat Sep 26 2026 Morgan Hough - 5.4.7-10 - python_wrapping: drop the duplicate itkTestDriver that ITK_WRAP_PYTHON installs into %%{python3_sitearch}/itk/. It is linked against the build tree, so check-rpaths rejects it (ERROR 0002 invalid runpath, ERROR 0010 empty runpath) and the build dies in %%install with the compile already finished. The real binary ships as %%{_bindir}/itkTestDriver from the core build. - Measured cost of ITK_WRAP_PYTHON on a COPR f44-x86_64 builder: 121 minutes to reach %%install (build 11039490), against ~6 minutes for ITK core alone (11034910). That is well inside the default timeout -- the header comment's worry that full templated wrapping would exceed SimpleITK's 6.8 hours was wrong, and the guess is now replaced by a number. - %%install prints the site-packages manifest, so a failure in check-rpaths or check-files still reports what was installed instead of costing another two hours to find out. - No change to the default build: still the same six subpackages. * Wed Sep 23 2026 Morgan Hough - 5.4.7-9 - InsightToolkit5-devel now ships %%{_rpmmacrodir}/macros.itk defining %%itk_ver, so a consumer can pin the ITK it was actually built against. - The problem it solves: ITK freezes sonames across releases while adding symbols. libITKFFT-5.4.so.1 is identical in name in 5.4.7-2 and -8, but -8 enabled FFTW and exports a registration symbol -2 does not. rpm derives dependencies from sonames, so a consumer built against -8 installs cleanly over -2 and dies at 127 on every invocation. Measured: c3d, itksnap, itksnap-alpha, simpleitk and quit all reference that symbol; 3dslicer and slicer-preview do not. - A floor rather than a vtk(abi)-style equality: the breakage is additive, so a newer ITK is always fine. Equality would force every consumer to rebuild on every ITK release for nothing. * Thu Sep 17 2026 Morgan Hough - 5.4.7-8 - Enable FFTW (ITK_USE_FFTWD and ITK_USE_FFTWF ON), matching Fedora's InsightToolkit. Earlier releases set only ITK_USE_SYSTEM_FFTW, which does nothing on its own: the installed ITKConfig.cmake of -7 has ITK_USE_FFTWD and ITK_USE_FFTWF OFF, while -devel still required fftw-devel. - Licensing consequence: FFTW is GPL-2.0-or-later, so the ITK libraries and anything linked against them are covered by the GPL (ITK's configure says so). This choice was made deliberately; see docs/licensing/itk-fftw-gpl.md. * Wed Sep 16 2026 Morgan Hough - 5.4.7-7 - Patch1: export the include dirs that system Eigen, VXL and double-conversion need. Bundled copies lived under /usr/include/ITK-5.4, so consumers never had to ask; unbundled, three consumer styles broke against -6: charm-gems (Eigen/Eigenvalues via ${ITK_INCLUDE_DIRS}), mitk (vnl/vnl_vector_ref.h via the ITKCommon target), elastix ("double-conversion.h"). Verified with a configure-only build: the installed module files and ITKTargets.cmake now carry the directories. - devel: Require double-conversion-devel, whose headers Patch1 now exports. -6 said no -devel was needed because no public ITK header includes it; true, but consumers do. * Wed Sep 16 2026 Morgan Hough - 5.4.7-6 - devel: Require eigen3-devel and vxl-devel. -5 unbundled both but left them out of the devel dependencies, so every consumer failed: find_package(Eigen3) from ITKEigen3.cmake, or a missing vnl/vnl_vector_ref.h and vxl_version.h. Found by test-rebuilding all 26 consumers against -5 (mhough/neurofedora-itk5-test): 18 of 18 finished builds failed this way. Fedora's InsightToolkit spec has the same gap. * Wed Sep 16 2026 Morgan Hough - 5.4.7-5 - Unbundle VXL, using Ankur Sinha's 0001-remove-vxl-netlib.patch from Fedora's InsightToolkit. -3 failed at link on "cannot find -lnetlib": with ITK_USE_SYSTEM_VXL=ON, ITK's own link lines add a "netlib" that system VXL does not ship (Fedora's vxl provides libv3p_netlib.so only). The patch removes it in two places and applies to 5.4.7 unchanged. - Correct the License field, which covered only ITK core (Apache-2.0) while the package ships bundled BSD-3-Clause, BSD-2-Clause, MIT, Zlib and public-domain code. Accounting follows Ankur's 84675f7, but is derived from what this build actually installs rather than copied, since our unbundling now differs. - Install each bundled library's licence text with %%license. Adds NIFTI's LICENSE, which Fedora's spec does not ship. * Tue Sep 15 2026 Morgan Hough - 5.4.7-4 - Revert ITK_USE_SYSTEM_VXL=ON: Fedora's vxl ships its netlib as libv3p_netlib.so while ITK links -lnetlib, so -3 died at link with "cannot find -lnetlib" (COPR 10990784). Eigen3 and DoubleConversion stay unbundled; they were the well-evidenced half of the convergence. * Tue Sep 15 2026 Morgan Hough - 5.4.7-3 - Unbundle Eigen3, DoubleConversion and VXL, converging with Fedora's InsightToolkit (Ankur Sinha), which has shipped all three from the system for some time. eigen3-devel 5.0.1, double-conversion-devel 3.4.0 and vxl-devel 3.5.0 all satisfy what ITK asks for. - The note justifying the Eigen bundling was wrong: it claimed eigen3 5.0.1 broke "ITK's find_package(Eigen3 3.3)", but ITK does a versionless find_package followed by an if(VERSION_LESS 3.3) check, which 5.0.1 passes. The SameMajorVersion failure is real for an explicitly versioned call, which ITK never makes. Fedora has built with ITK_USE_SYSTEM_EIGEN=ON since 2026-08-10, seven months after eigen3 5.0.1 landed. - Drop -DITK_USE_SYSTEM_OPENJPEG=ON. ITK defines no such option and bundles OpenJPEG 1.x, so CMake was silently ignoring the flag; declare Provides: bundled(openjpeg) instead, which was missing. - Document the remaining bundles and why each has no system option, following the same accounting Fedora's spec keeps. * Thu Sep 03 2026 Morgan Hough - 5.4.7-1 - Update to 5.4.7. Drops both Slicer backports and both %%prep seds: * ITK-slicer-5d-nrrd-io.patch: AxesReorder appears 13 times in 5.4.7's itkNrrdImageIO.{h,cxx} and 0 times in 5.4.6 -- the API is upstream. * ITK-slicer-short-axis-crashfix.patch: the bounds guard and identity fallback are in itkImageFileReader.hxx at lines 184 and 190. * the cstdint sed: itkFloatingPointExceptions.h now includes itself, so the sed only added a duplicate. * the bundled-Eigen typename sed: no occurrences left in Quaternion.h. * Mon Aug 24 2026 Morgan Hough - 5.4.6-9 - Rebuild against VTK 9.7.0. VTK here installs unversioned sonames (libvtk*.so.1), so 9.7 replaces 9.6 in place and every consumer must be rebuilt or it fails at runtime with undefined symbols. Release bumped past the aarch64 dcmtk rebuild that landed on main with the same number: that NVR is already published, and a same-NVR rebuild does not supersede (ci/PROCEDURES.md rule 3). * Sat Aug 22 2026 Morgan Hough - 5.4.6-8 - Rebuild for aarch64 against dcmtk 3.7.0-3 (SONAME 19 -> 20). The aarch64 5.4.6-7 build was compiled against Fedora's dcmtk 3.6.9 (.so.19) before the COPR dcmtk reached that arch, so it still requires libdcm*.so.19 -- which nothing in the repo provides now, making ITK uninstallable on aarch64 and taking the whole stack with it (ctk-dicom, plastimatch, 3dslicer, medInria, OpenImageIO). x86_64 at -7 was already built against .so.20 and is correct; this Release bump exists only so the replacement aarch64 RPM reliably supersedes the broken -7, since both arches shared that NVR. x86_64 deliberately not rebuilt. * Sun May 31 2026 Morgan Hough - 5.4.6-7 - Add cli11-devel BuildRequires: VTK 9.6.2 added CLI11 as a module dependency, so VTK's cmake config now find_package(CLI11)s at configure time and any find_package(VTK) consumer (Modules/Bridge/VtkGlue) needs it in the buildroot. * Sun May 31 2026 Morgan Hough - 5.4.6-6 - Backport two accepted-upstream ITK commits that 3D Slicer's curated Slicer/ITK fork carries (the full fork is pristine v5.4.6 + only 5 such patches). Patch0: 5D NRRD I/O / NrrdImageIO AxesReorder (cherry-pick of InsightSoftwareConsortium/ITK@10389fb0), required by Slicer's vtkITKImageSequenceReader which fails to compile without the itk::NrrdImageIOEnums::AxesReorder enum and Set/GetAxesReorder API. Patch1: ImageFileReader crash fix for short axis direction vectors. Both are additive and scoped to NRRD/ImageBase; no ABI change for existing consumers (NrrdImageIO is only used via New()/SmartPointer). * Thu May 28 2026 Morgan Hough - 5.4.6-5 - Enable Module_ITKIODCMTK. Built-in but EXCLUDE_FROM_DEFAULT in ITK 5.4. Surfaced by 3dslicer-9 retry after MGHIO/IOScanco were resolved. * Thu May 28 2026 Morgan Hough - 5.4.6-4 - Fix MGHIO + IOScanco for 3D Slicer. MGHIO and IOScanco are ITK *remote* modules (not built-in), so Module_MGHIO/Module_IOScanco only have effect if the module sources are present under Modules/Remote/ — they would normally be Git-fetched at cmake time but our ITK_FORBID_DOWNLOADS=ON policy blocks that. Add Source7 (itkMGHImageIO@0adac35f) and Source8 (ITKIOScanco@10b80f69), pre-staged in %prep. Also drop the misspelled -DModule_ITKIOMGH (the correct name is Module_MGHIO; -3's flag was silently ignored, per cmake's "unused variables" warning). * Thu May 28 2026 Morgan Hough - 5.4.6-3 - Enable Module_ITKIOMGH, Module_ITKIOTransformMatlab, Module_IOScanco. 3D Slicer's Libs/ITKFactoryRegistration calls find_package(ITK COMPONENTS MGHIO ITKIOTransformMatlab IOScanco ...) and aborts if any are missing. * Sun May 24 2026 Morgan Hough - 5.4.6-2 - Strip the invalid `typename std::is_nothrow_move_*::value` keyword from bundled itkeigen/Eigen/src/Geometry/Quaternion.h (GCC 16 now enforces what was always-invalid C++: typename only applies to types). Fixes downstream FTBFS in every ITK consumer that touches Eigen Quaternion code (quit, medInria, plastimatch, simpleitk, ...). Companion fix in InsightToolkit6.spec. * Mon May 18 2026 Morgan Hough - 5.4.6-1 - Update to ITK 5.4.6 (upstream release 2026-05-01) - Backport of GDCM CVE-2026-3650 fix and a GDCM upstream sync - Stability fixes: VoronoiDiagram2DGenerator infinite loop, IPLCommonImageIO null-check hardening, integer-only Bresenham line construction - Remote module commits unchanged from 5.4.5 (verified against 5.4.6 tags) * Tue Mar 17 2026 Morgan Hough - 5.4.5-15 - Add doc and examples subpackages (matches Fedora ITK4 package structure) * Sun Mar 15 2026 Morgan Hough - 5.4.5-14 - Add SimpleITKFilters and LabelErodeDilate remote modules (Source5, Source6): required by SimpleITK 2.5.x * Fri Mar 06 2026 Morgan Hough - 5.4.5-13 - Add GrowCut remote module (Source4): provides itkFastGrowCut.h required by MITK's Segmentation module * Thu Mar 05 2026 Morgan Hough - 5.4.5-12 - Fedora-submission polish: unbundle DCMTK (ITK_USE_SYSTEM_DCMTK=ON), split vtk/vtk-devel subpackages for ITKVtkGlue bridge, add Provides: bundled() for double-conversion/eigen3/nifti/metaio/kwsys, add ExcludeArch: ix86, add ldconfig scriptlets, suppress debug_package - Enable VtkGlue, PhilipsREC, Review, Deprecated modules - Add VTK transitive cmake deps as BuildRequires (python3-devel, json-devel, Qt6, etc.) needed by VTK-vtk-module-find-packages.cmake * Thu Mar 05 2026 Morgan Hough - 5.4.5-11 - Enable Module_ITKReview=ON: provides itkLabelGeometryImageFilter.h required by MITK's Multilabel module (ITKDeprecated alone was insufficient) * Thu Mar 05 2026 Morgan Hough - 5.4.5-10 - Enable Module_ITKDeprecated=ON: dependency of ITKReview * Fri Feb 27 2026 Morgan Hough - 5.4.5-9 - Add MorphologicalContourInterpolation remote module (Source3): required by ITK-SNAP 4.x which requests it as a FIND_PACKAGE(ITK COMPONENTS ...) component * Wed Feb 25 2026 Morgan Hough - 5.4.5-8 - Guard bundled MINC cmake cleanup with directory existence check * Wed Feb 25 2026 Morgan Hough - 5.4.5-7 - Remove cmake configs for ITK's bundled MINC library in the install step * Tue Feb 24 2026 Morgan Hough - 5.4.5-6 - Add AdaptiveDenoising remote module (Source2) * Tue Feb 24 2026 Morgan Hough - 5.4.5-5 - Bundle GenericLabelInterpolator remote module (Source1) * Tue Feb 24 2026 Morgan Hough - 5.4.5-4 - Disable Module_ITKGoogleTest (OFF) * Tue Feb 24 2026 Morgan Hough - 5.4.5-3 - Add transitive system-lib Requires to -devel * Tue Feb 24 2026 Morgan Hough - 5.4.5-2 - Remove zero-length stub.h placeholders * Mon Feb 23 2026 Morgan Hough - 5.4.5-1 - Initial package of ITK 5.4.5 * Tue Feb 03 2026 Maintainer - 5.4.2-1 - Initial package for ITK 5.4.2