Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ITKSoftwareGuide.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}:")
Expand Down
1 change: 0 additions & 1 deletion SoftwareGuide/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
#
Expand Down
9 changes: 4 additions & 5 deletions SoftwareGuide/Cover/Source/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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()
90 changes: 69 additions & 21 deletions SoftwareGuide/Latex/Introduction/Installation.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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}

Expand Down Expand Up @@ -574,28 +574,75 @@ \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 Module1 Module2)
Comment thread
thewtex marked this conversation as resolved.
Outdated

add_executable(Example Example.cxx)
target_link_libraries(Example ITK::Module1 ITK::Module2)
\end{minted}
\normalsize

e.g.

\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
)
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()
Comment thread
thewtex marked this conversation as resolved.
Outdated

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
Comment thread
thewtex marked this conversation as resolved.
Outdated
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.
Expand All @@ -605,7 +652,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 "<tag id>" # specify the commit id or the tag id
SOURCE_DIR <ITK source tree path>
BINARY_DIR <ITK build tree path>
Expand Down Expand Up @@ -644,17 +691,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
Expand All @@ -663,9 +711,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
Expand Down
4 changes: 2 additions & 2 deletions SuperBuild/External_ITK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
Loading