Skip to content

InsightSoftwareConsortium/ITKModuleTemplate

 
 

Repository files navigation

ITKModuleTemplate

Overview

This is a module for the Insight Toolkit (ITK) for segmentation and registration. It is designed to work with the ITK modular system.

This module is a template to be used as a starting point for a new ITK module.

Getting Started

The following will get an external module started in a new repository:

python -m pip install cookiecutter
python -m cookiecutter gh:InsightSoftwareConsortium/ITKModuleTemplate
# Fill in the information requested at the prompts

Reasonable defaults will be provided for all of the parameters. The parameters are:

full_name
Your full name.
email
Your email.
project_name
This is a name for the project, which is ITK followed by the module name, by convention. Examples include ITKIsotropicWavelets or ITKBoneMorphometry.
module_name
This is the name of the module. Since this is an external module, it does not start with the ITK prefix. It is in CamelCase, by convention. Examples include IsotropicWavelets and BoneMorphometry.
filter_name
The skeleton of an itk::ImageToImageFilter will be created by default. Optionally specify this value, if you will be adding an itk::ImageToImageFilter to your module.
python_package_name
This is the name of the Python package that will be created from the module. By convention, this is itk- For example, itk-isotropicwavelets or itk-bonemorphometry.
download_url
This is the download url added to the Python package metadata. This can be the GitHub repository URL.
project_short_description
A short description to use in the project README, module Doxygen documentation, and Python package documentation.
project_long_description
A long description to use in the project README, module Doxygen documentation, and Python package documentation.

The output of the cookiecutter is a buildable ITK external module with example classes. Remove or replace the classes with your new classes. Push your new module to GitHub. Cross-platform C++ testing and Python packaging is provided via the ITKRemoteModuleBuildTestPackageAction reusable GitHub Action.

Documentation on how to populate the module can be found in the ITK Software Guide.

To improve the discoverability of your module on GitHub, first push the associated repository, then add itk-module to the project's GitHub Topics .

Remote Module

After an Insight Journal article has been submitted, the module can be included in ITK as a remote module. Add a file in "ITK/Modules/Remote" called "YourModule.remote.cmake", for this module it would be "ExternalExample.remote.cmake" with the followlowing contents:

itk_fetch_module(MyModule
  "A description of the a module."
  GIT_REPOSITORY https://github.com/myuser/ITKMyModule.git
  GIT_TAG abcdef012345
  )

CI Testing and Python Packages

Continuous integration service configurations are included to build and test the C++ core of packages across platforms and build binary Python packages for Linux, macOS, and Windows. For more information, see the ITKRemoteModuleBuildTestPackageAction documentation.

pyproject.toml migration

ITK 5.4 added support for scikit-build-core, an update to scikit-build classic that supports PEP 517 and other modern Python packaging standards configured in the declarative pyproject.toml file. While the setup.py file is still supported in ITK 5.4, migration to pyproject.toml is encouraged. One important advantage is the generation of Stable ABI wheels for Python 3.11+; these packages work with Python 3.11, 3.12, 3.13, 3.14, etc. To migrate to scikit-build-core, use the pyproject.toml template in this repository and remove the setup.py file.

ITKv4 Branch

In the transition to the major release of ITKv5 your module might want to be compatible with both versions: ITKv4 and ITKv5. In order to do that, keep the master branch for development with ITKv5, and create another branch, named ITKv4, or release, that is compatible with the version 4.13 of ITK. For examples and updated information on how to do this: please check the discourse conversation.

License

This software is distributed under the Apache 2.0 license. Please see the LICENSE file for details.

Authors

  • Bradley Lowekamp
  • Matt McCormick
  • Jean-Baptiste VIMORT