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/SoftwareGuide/Latex/Introduction/Installation.tex b/SoftwareGuide/Latex/Introduction/Installation.tex index 3d7e924a..4857c736 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} @@ -574,9 +574,15 @@ \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}) +set(MINIMUM_ITK_VERSION 6.0) +find_package(ITK ${MINIMUM_ITK_VERSION} REQUIRED + COMPONENTS + ITKCommon + ITKSmoothing + ) + +add_executable(Example Example.cxx) +target_link_libraries(Example ITK::ITKCommonModule ITK::ITKSmoothingModule) \end{minted} \normalsize @@ -584,18 +590,64 @@ \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 +set(MINIMUM_ITK_VERSION 6.0) +find_package(ITK ${MINIMUM_ITK_VERSION} REQUIRED COMPONENTS MorphologicalContourInterpolation ITKSmoothing ITKIOImageBase ITKIONRRD + ) + +add_executable(Example Example.cxx) +target_link_libraries(Example + ITK::MorphologicalContourInterpolationModule + ITK::ITKSmoothingModule + ITK::ITKIOImageBaseModule + ITK::ITKIONRRDModule + ) +# 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 + ITKImageIO ) -include(\${ITK_USE_FILE}) +itk_generate_factory_registration(ImageIO) + +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 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 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. @@ -605,7 +657,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 @@ -644,17 +696,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) -find_package(ITK \${MINIMUM_ITK_VERSION} REQUIRED) -include(${ITK_USE_FILE}) +set(MINIMUM_ITK_VERSION 6.0) +find_package(ITK ${MINIMUM_ITK_VERSION} REQUIRED) +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 +716,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 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}