Build ITK Modules Outside the Main Repository

ITK’s architectural modularization, which occurred in version 4.0, allowed the toolkit to scale in content while remaining organized.  In particular, we introduced remote modules that allowed methods to be redistributed for optional inclusion when ITK is built.   Additionally, we made it easy for researchers to extend existing ITK methods and develop entirely new ITK methods within a pre-configured and easy-to-use development environment within a special directory of the ITK source tree.  These methods could include support for new file formats and even the development of segmentation methods that rely on third-party libraries such as LibSVM for machine learning, Boost for advanced data structures, or VTK for integrated visualizations.

 

Thanks to changes in upcoming ITK release 4.9.0, it is now also possible to extend ITK and develop new ITK methods outside the ITK source tree.  Additionally, these externally built modules also provide faster CMake configuration times and can be integrated into ITK’s Python wrapping. It also makes it easier to add continuous integration testing to module GitHub repositories.

 

To add external build support, change a module’s top level CMakeLists.txt content from:



project(ModuleName)

itk_module_impl()

 

to:

cmake_minimum_required(VERSION 2.8.9)

project(ModuleName)



if(NOT ITK_SOURCE_DIR)

 find_package(ITK REQUIRED)

 list(APPEND CMAKE_MODULE_PATH ${ITK_CMAKE_DIR})

 include(ITKModuleExternal)

else()

 itk_module_impl()

endif()

Questions or comments are always welcome!