From a379b90653e41928d952d7a17390831c331f0532 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Fri, 13 Mar 2026 17:23:45 -0400 Subject: [PATCH 1/8] COMP: Bump ITK to 6.0 Beta 2 Includes ITK CMake target configuration updates. --- ITKSoftwareGuide.cmake | 1 - SoftwareGuide/CMakeLists.txt | 1 - SoftwareGuide/Cover/Source/CMakeLists.txt | 9 ++++----- SuperBuild/External_ITK.cmake | 4 ++-- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/ITKSoftwareGuide.cmake b/ITKSoftwareGuide.cmake index 2c2504ca..a54ddd06 100644 --- a/ITKSoftwareGuide.cmake +++ b/ITKSoftwareGuide.cmake @@ -16,7 +16,6 @@ find_package(ITK ${MINIMUM_ITK_VERSION} REQUIRED) if(Slicer_BUILD_${PROJECT_NAME}) set(ITK_NO_IO_FACTORY_REGISTER_MANAGER 1) # Incorporate with Slicer nicely endif() -include(${ITK_USE_FILE}) if( NOT IS_DIRECTORY "${ITK_SOURCE_DIR}" ) message(FATAL_ERROR "ITK source directory is not set :${ITK_SOURCE_DIR}:") diff --git a/SoftwareGuide/CMakeLists.txt b/SoftwareGuide/CMakeLists.txt index 9193c94f..d701c014 100644 --- a/SoftwareGuide/CMakeLists.txt +++ b/SoftwareGuide/CMakeLists.txt @@ -32,7 +32,6 @@ project(SoftwareGuide C) set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake ${CMAKE_MODULE_PATH}) find_package(ITK 5 REQUIRED) -include(${ITK_USE_FILE}) set(PDF_QUALITY_LEVEL "Screen" CACHE STRING "PDF Quality. Options are: Screen, Printer, PrePress") # diff --git a/SoftwareGuide/Cover/Source/CMakeLists.txt b/SoftwareGuide/Cover/Source/CMakeLists.txt index 2e9ae9b2..af7b806a 100644 --- a/SoftwareGuide/Cover/Source/CMakeLists.txt +++ b/SoftwareGuide/Cover/Source/CMakeLists.txt @@ -1,10 +1,9 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) cmake_policy(VERSION 3.10.2) - -project( VWSegmentation ) -find_package( ITK 5 REQUIRED ) -include( ${ITK_USE_FILE} ) +project(VWSegmentation) + +find_package(ITK 6 REQUIRED) set( operations VWHistogramRGB @@ -23,5 +22,5 @@ set( operations foreach( operation ${operations} ) add_executable( ${operation} ${operation}.cxx ) - target_link_libraries( ${operation} ${ITK_LIBRARIES} ) + target_link_libraries( ${operation} ${ITK_INTERFACE_LIBRARIES} ) endforeach() diff --git a/SuperBuild/External_ITK.cmake b/SuperBuild/External_ITK.cmake index 23ca0544..8c6b3aa2 100644 --- a/SuperBuild/External_ITK.cmake +++ b/SuperBuild/External_ITK.cmake @@ -104,8 +104,8 @@ if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "USE_SYSTEM_${extProjName}" A ### --- End Project specific additions set(${proj}_REPOSITORY ${git_protocol}://github.com/InsightSoftwareConsortium/ITK.git) if("${${proj}_GIT_TAG}" STREQUAL "") - # ITK main branch 2025-09-24 - set(${proj}_GIT_TAG "v6.0b01") + # ITK release branch 2026-02-25 + set(${proj}_GIT_TAG "v6.0b02") endif() ExternalProject_Add(${proj} From d0974a8b3f8a2cf589fef7ecd82688182580d2da Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Sat, 14 Mar 2026 15:00:23 -0400 Subject: [PATCH 2/8] DOC: Update HelloWorld guide to use ITK 6 CMake targets For simplicity we just use ITK_INTERFACE_LIBRARIES. --- .../Latex/Introduction/Installation.tex | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/SoftwareGuide/Latex/Introduction/Installation.tex b/SoftwareGuide/Latex/Introduction/Installation.tex index 3d7e924a..2a97f1bd 100644 --- a/SoftwareGuide/Latex/Introduction/Installation.tex +++ b/SoftwareGuide/Latex/Introduction/Installation.tex @@ -644,17 +644,18 @@ \subsection{Hello World!}% The \code{CMakeLists.txt} file contains the following lines: % CMake looks similar to bash with regards to formatting. -\begin{minted}[linenos=false]{cmake} +\small +\begin{minted}[baselinestretch=1,fontsize=\footnotesize,linenos=false,bgcolor=ltgray]{cmake} project(HelloWorld) -set(MINIMUM_ITK_VERSION 5.4) +set(MINIMUM_ITK_VERSION 6.0) find_package(ITK \${MINIMUM_ITK_VERSION} REQUIRED) -include(${ITK_USE_FILE}) +itk_generate_factory_registration() add_executable(HelloWorld HelloWorld.cxx) - -target_link_libraries(HelloWorld ${ITK_LIBRARIES}) +target_link_libraries(HelloWorld ${ITK_INTERFACE_LIBRARIES}) \end{minted} +\normalsize The first line defines the name of your project as it appears in Visual Studio or Eclipse; this line will have no effect with UNIX/Linux Makefiles. The second @@ -663,9 +664,9 @@ \subsection{Hello World!}% corrected by providing the location of the directory where ITK was compiled or installed on your system. In this case the path to the ITK's binary/installation directory needs to be specified as the value of the \code{ITK\_DIR} CMake -variable. The line \code{include(\$\{USE\_ITK\_FILE\})} loads the -\code{UseITK.cmake} file which contains the configuration information about the -specified ITK build. The line starting with \code{add\_executable} call defines +variable. The line \code{itk\_generate\_factory\_registration()} generates configuration +to enable input-output factory class registration in the subsequent executable. +The line starting with \code{add\_executable} call defines as its first argument the name of the executable that will be produced as result of this project. The remaining argument(s) of \code{add\_executable} are the names of the source files to be compiled. Finally, the From 32ea6e96b40702ef87511787abd307c64796f965 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Sat, 14 Mar 2026 15:07:37 -0400 Subject: [PATCH 3/8] DOC: Update download and git links in Configuring and Building ITK Now on GitHub and ReadTheDocs. --- SoftwareGuide/Latex/Introduction/Installation.tex | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SoftwareGuide/Latex/Introduction/Installation.tex b/SoftwareGuide/Latex/Introduction/Installation.tex index 2a97f1bd..ec1f2a35 100644 --- a/SoftwareGuide/Latex/Introduction/Installation.tex +++ b/SoftwareGuide/Latex/Introduction/Installation.tex @@ -51,13 +51,13 @@ \section{Obtaining the Software}% There are two different ways to access the ITK source code: \begin{description} \item[Periodic releases]{Official releases are available on the ITK web - site\footnote{\url{https://itk.org/ITK/resources/software.html}}. + site\footnote{\url{https://docs.itk.org/en/latest/download.html}}. They are released twice a year, and announced on the ITK web pages and discussion. However, they may not provide the latest and greatest features of the toolkit.} \item[Continuous repository checkout]{Direct access to the Git source code - repository\footnote{\url{https://itk.org/ITK.git}} provides immediate + repository\footnote{\url{https://github.com/InsightSoftwareConsortium/ITK.git}} provides immediate availability to the latest toolkit additions. But, on any given day the source code may not be stable as compared to the official releases.} \end{description} @@ -79,7 +79,7 @@ \subsection{Downloading Packaged Releases}% ITK can be downloaded without cost from the following web site: \begin{center} - \url{https://www.itk.org/ITK/resources/software.html} + \url{https://docs.itk.org/en/latest/download.html} \end{center} On the web page, choose the tarball that better fits your system. The options are @@ -104,7 +104,7 @@ \subsection{Downloading From Git}% Access ITK via Git using the following commands (under a Git Bash shell): \begin{minted}[baselinestretch=1,fontsize=\footnotesize,linenos=false,bgcolor=ltgray]{bash} -git clone git://itk.org/ITK.git +git clone https://github.com/InsightSoftwareConsortium/ITK \end{minted} This will trigger the download of the software into a directory named @@ -129,7 +129,7 @@ \subsection{Data}% Another source of data can be obtained from the ITK Web site at either of the following: \begin{quote} -\url{https://www.itk.org/ITK/resources/links.html} \\ +\url{https://docs.itk.org/en/latest/download.html} \\ \url{ftp://public.kitware.com/pub/itk/Data/}. \end{quote} From 3374fe4d7f98d84dddb1ae38d6946aa1b8e6dc0d Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Sat, 14 Mar 2026 15:09:14 -0400 Subject: [PATCH 4/8] DOC: Remove invalid CMake escape characters From the Configuring and Building ITK section. These are passed through in the minted code listing. --- SoftwareGuide/Latex/Introduction/Installation.tex | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/SoftwareGuide/Latex/Introduction/Installation.tex b/SoftwareGuide/Latex/Introduction/Installation.tex index ec1f2a35..b29b68a1 100644 --- a/SoftwareGuide/Latex/Introduction/Installation.tex +++ b/SoftwareGuide/Latex/Introduction/Installation.tex @@ -575,8 +575,8 @@ \section{Using ITK as an External Library}% \small \begin{minted}[baselinestretch=1,fontsize=\footnotesize,linenos=false,bgcolor=ltgray]{cmake} set(MINIMUM_ITK_VERSION 5.4) -find_package(ITK \${MINIMUM_ITK_VERSION} REQUIRED COMPONENTS Module1 Module2) -include(\${ITK_USE_FILE}) +find_package(ITK ${MINIMUM_ITK_VERSION} REQUIRED COMPONENTS Module1 Module2) +include(${ITK_USE_FILE}) \end{minted} \normalsize @@ -585,14 +585,14 @@ \section{Using ITK as an External Library}% \small \begin{minted}[baselinestretch=1,fontsize=\footnotesize,linenos=false,bgcolor=ltgray]{cmake} set(MINIMUM_ITK_VERSION 5.4) -find_package(ITK \${MINIMUM_ITK_VERSION} REQUIRED +find_package(ITK ${MINIMUM_ITK_VERSION} REQUIRED COMPONENTS MorphologicalContourInterpolation ITKSmoothing ITKIOImageBase ITKIONRRD ) -include(\${ITK_USE_FILE}) +include(${ITK_USE_FILE}) \end{minted} \normalsize @@ -605,7 +605,7 @@ \section{Using ITK as an External Library}% \small \begin{minted}[baselinestretch=1,fontsize=\footnotesize,linenos=false,bgcolor=ltgray]{cmake} ExternalProject_Add(ITK - GIT_REPOSITORY \${git_protocol}://github.com/InsightSoftwareConsortium/ITK.git" + GIT_REPOSITORY https://github.com/InsightSoftwareConsortium/ITK.git" GIT_TAG "" # specify the commit id or the tag id SOURCE_DIR BINARY_DIR @@ -649,7 +649,7 @@ \subsection{Hello World!}% project(HelloWorld) set(MINIMUM_ITK_VERSION 6.0) -find_package(ITK \${MINIMUM_ITK_VERSION} REQUIRED) +find_package(ITK ${MINIMUM_ITK_VERSION} REQUIRED) itk_generate_factory_registration() add_executable(HelloWorld HelloWorld.cxx) From 8f684b16bc9027aa19c6e8dfc9828c7e361a9acc Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Sun, 15 Mar 2026 15:00:33 -0400 Subject: [PATCH 5/8] DOC: find_package component example with itk_generate_factory_registration() Approach with ITK 6 CMake targets. --- .../Latex/Introduction/Installation.tex | 55 +++++++++++++++++-- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/SoftwareGuide/Latex/Introduction/Installation.tex b/SoftwareGuide/Latex/Introduction/Installation.tex index b29b68a1..c78f915a 100644 --- a/SoftwareGuide/Latex/Introduction/Installation.tex +++ b/SoftwareGuide/Latex/Introduction/Installation.tex @@ -574,9 +574,11 @@ \section{Using ITK as an External Library}% \small \begin{minted}[baselinestretch=1,fontsize=\footnotesize,linenos=false,bgcolor=ltgray]{cmake} -set(MINIMUM_ITK_VERSION 5.4) +set(MINIMUM_ITK_VERSION 6.0) find_package(ITK ${MINIMUM_ITK_VERSION} REQUIRED COMPONENTS Module1 Module2) -include(${ITK_USE_FILE}) + +add_executable(Example Example.cxx) +target_link_libraries(Example ITK::Module1 ITK::Module2) \end{minted} \normalsize @@ -584,7 +586,7 @@ \section{Using ITK as an External Library}% \small \begin{minted}[baselinestretch=1,fontsize=\footnotesize,linenos=false,bgcolor=ltgray]{cmake} -set(MINIMUM_ITK_VERSION 5.4) +set(MINIMUM_ITK_VERSION 6.0) find_package(ITK ${MINIMUM_ITK_VERSION} REQUIRED COMPONENTS MorphologicalContourInterpolation @@ -592,10 +594,55 @@ \section{Using ITK as an External Library}% ITKIOImageBase ITKIONRRD ) -include(${ITK_USE_FILE}) + +add_executable(Example Example.cxx) +target_link_libraries(Example + ITK::MorphologicalContourInterpolation + ITK::ITKSmoothing + ITK::ITKIOImageBase + ITK::ITKIONRRD + ) +# or +target_link_libraries(Example ${ITK_INTERFACE_LIBRARIES}) \end{minted} \normalsize +ITK uses factory registration to load IO formats and pluggable components at runtime. +ITK 6 uses meta-modules that simplify factory registration by grouping related modules together. + +Factory meta-modules include: + +\begin{description} + \item[ITKImageIO] All image IO modules (JPEG, PNG, NIFTI, DICOM, etc.). + \item[ITKMeshIO] All mesh IO modules. + \item[ITKTransformIO] Transform IO modules. + \item[ITKFFTImageFilterInit] FFT implementations. +\end{description} + +To register all factories: + +\small +\begin{minted}[baselinestretch=1,fontsize=\footnotesize,linenos=false,bgcolor=ltgray]{cmake} +set(MINIMUM_ITK_VERSION 6.0) +find_package(ITK ${MINIMUM_ITK_VERSION} REQUIRED + COMPONENTS + MorphologicalContourInterpolation + ITKSmoothing + ITKIOImageBase + ITKIONRRD + ) +itk_generate_factory_registration() + +add_executable(Example Example.cxx) +target_link_libraries(Example ${ITK_INTERFACE_LIBRARIES} ITK::ITKImageIO) +\end{minted} +\normalsize + +The \code{itk\_generate\_factory\_registration()} macro must be called before adding executables. +The CMake macro generates registration code for the IO modules and factory-enabled components from +the modules loaded in \code{find\_package()}. The meta-module must be linked to the target to +include and enable the generated registration code. + If you would like to use the CMake ExternalProject Module\footnote{\url{https://cmake.org/cmake/help/latest/module/ExternalProject.html}} to download ITK source code when building your ITK application (a.k.a. From ddbc09ca23f501258791fc6b0830dc6407c7ff3c Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Mon, 16 Mar 2026 13:44:55 -0400 Subject: [PATCH 6/8] DOC: Use real modules for find_package example Demonstrates relationship between ITKCommon module and ITK::ITKCommonModule target. --- .../Latex/Introduction/Installation.tex | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/SoftwareGuide/Latex/Introduction/Installation.tex b/SoftwareGuide/Latex/Introduction/Installation.tex index c78f915a..8077e298 100644 --- a/SoftwareGuide/Latex/Introduction/Installation.tex +++ b/SoftwareGuide/Latex/Introduction/Installation.tex @@ -575,10 +575,14 @@ \section{Using ITK as an External Library}% \small \begin{minted}[baselinestretch=1,fontsize=\footnotesize,linenos=false,bgcolor=ltgray]{cmake} set(MINIMUM_ITK_VERSION 6.0) -find_package(ITK ${MINIMUM_ITK_VERSION} REQUIRED COMPONENTS Module1 Module2) +find_package(ITK ${MINIMUM_ITK_VERSION} REQUIRED + COMPONENTS + ITKCommon + ITKSmoothing + ) add_executable(Example Example.cxx) -target_link_libraries(Example ITK::Module1 ITK::Module2) +target_link_libraries(Example ITK::ITKCommonModule ITK::ITKSmoothingModule) \end{minted} \normalsize @@ -593,15 +597,15 @@ \section{Using ITK as an External Library}% ITKSmoothing ITKIOImageBase ITKIONRRD - ) + ) add_executable(Example Example.cxx) target_link_libraries(Example - ITK::MorphologicalContourInterpolation - ITK::ITKSmoothing - ITK::ITKIOImageBase - ITK::ITKIONRRD - ) + ITK::MorphologicalContourInterpolationModule + ITK::ITKSmoothingModule + ITK::ITKIOImageBaseModule + ITK::ITKIONRRDModule + ) # or target_link_libraries(Example ${ITK_INTERFACE_LIBRARIES}) \end{minted} From b3a34937436be0152e7acdb9a2cec30b3c8bb085 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Mon, 16 Mar 2026 13:47:08 -0400 Subject: [PATCH 7/8] DOC: Use explicit ImageIO argument to itk_generate_factory_registration() Also make sure to use ITKImageIO for the find_package COMPONENT. --- SoftwareGuide/Latex/Introduction/Installation.tex | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/SoftwareGuide/Latex/Introduction/Installation.tex b/SoftwareGuide/Latex/Introduction/Installation.tex index 8077e298..bb840b8b 100644 --- a/SoftwareGuide/Latex/Introduction/Installation.tex +++ b/SoftwareGuide/Latex/Introduction/Installation.tex @@ -632,10 +632,9 @@ \section{Using ITK as an External Library}% COMPONENTS MorphologicalContourInterpolation ITKSmoothing - ITKIOImageBase - ITKIONRRD + ITKImageIO ) -itk_generate_factory_registration() +itk_generate_factory_registration(ImageIO) add_executable(Example Example.cxx) target_link_libraries(Example ${ITK_INTERFACE_LIBRARIES} ITK::ITKImageIO) From 8083f7a49842e58e1cef4adf567c94266f8e778a Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Mon, 16 Mar 2026 13:50:11 -0400 Subject: [PATCH 8/8] DOC: Clarify the factory and meta-interface relationship --- SoftwareGuide/Latex/Introduction/Installation.tex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SoftwareGuide/Latex/Introduction/Installation.tex b/SoftwareGuide/Latex/Introduction/Installation.tex index bb840b8b..4857c736 100644 --- a/SoftwareGuide/Latex/Introduction/Installation.tex +++ b/SoftwareGuide/Latex/Introduction/Installation.tex @@ -642,8 +642,10 @@ \section{Using ITK as an External Library}% \normalsize The \code{itk\_generate\_factory\_registration()} macro must be called before adding executables. -The CMake macro generates registration code for the IO modules and factory-enabled components from -the modules loaded in \code{find\_package()}. The meta-module must be linked to the target to +The CMake macro generates registration code for all the IO modules and factory-enabled components from +the modules loaded in \code{find\_package()}. The \code{ITKImageIO} +meta-module and \code{ITK::ITKImageIO} meta-interface target bring in all ITK +image IO modules available in the build. The meta-interface target must be linked to the target to include and enable the generated registration code. If you would like to use the CMake ExternalProject