Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
63 changes: 63 additions & 0 deletions CMake/ITKGroups.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,69 @@ foreach(group ${group_list})
list(APPEND ITK_MODULE_${itk-module}_REQUEST_BY ITKGroup_${group})
endforeach()
endif()

# Sub-group support: ITKGroup_Remote_Analysis, ITKGroup_Remote_IO, etc.
# When a sub-group is ON, request building all modules discovered within
# that sub-group's directory (e.g., Modules/Remote/Analysis/*).
if("${group}" STREQUAL "Remote")
file(
GLOB _remote_subdirs
RELATIVE "${ITK_SOURCE_DIR}/Modules/Remote"
"${ITK_SOURCE_DIR}/Modules/Remote/*/itk-module.cmake"
)
# Collect sub-group names from directories that contain itk-module.cmake
# at depth 2 (e.g., Analysis/TextureFeatures/itk-module.cmake)
set(_remote_subgroups)
foreach(_rmod_file ${_remote_subdirs})
# These are flat: "ModuleName/itk-module.cmake" — skip
endforeach()
file(
GLOB _remote_subgroup_files
RELATIVE "${ITK_SOURCE_DIR}/Modules/Remote"
"${ITK_SOURCE_DIR}/Modules/Remote/*/*/itk-module.cmake"
)
foreach(_rmod_file ${_remote_subgroup_files})
# Extract sub-group name (first path component)
string(REGEX MATCH "^([^/]+)/" _match "${_rmod_file}")
set(_subgroup_name "${CMAKE_MATCH_1}")
if(_subgroup_name AND NOT "${_subgroup_name}" STREQUAL "Deprecated")
list(APPEND _remote_subgroups ${_subgroup_name})
endif()
endforeach()
if(_remote_subgroups)
list(REMOVE_DUPLICATES _remote_subgroups)
endif()

foreach(_subgroup ${_remote_subgroups})
if(ITKGroup_Remote_${_subgroup})
# Find all modules in this sub-group and request them.
# Unlike the default group mechanism, an explicitly enabled sub-group
# requests ALL its modules including those with EXCLUDE_FROM_DEFAULT.
file(
GLOB _subgroup_module_files
"${ITK_SOURCE_DIR}/Modules/Remote/${_subgroup}/*/itk-module.cmake"
)
foreach(_mod_file ${_subgroup_module_files})
file(READ ${_mod_file} _mod_content)
string(
REGEX
MATCH
"itk_module[ \n]*(\\([ \n]*)([A-Za-z0-9]*)"
_m
"${_mod_content}"
)
set(_mod_name "${CMAKE_MATCH_2}")
if(_mod_name)
list(
APPEND
ITK_MODULE_${_mod_name}_REQUEST_BY
ITKGroup_Remote_${_subgroup}
)
endif()
endforeach()
endif()
endforeach()
endif()
# Hide group options if building all modules anyway.
if(ITK_BUILD_DEFAULT_MODULES)
set_property(
Expand Down
1 change: 1 addition & 0 deletions CMake/ITKModuleEnablement.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ macro(itk_module_load_dag)
GLOB_RECURSE meta
RELATIVE "${ITK_SOURCE_DIR}"
"${ITK_SOURCE_DIR}/*/*/*/itk-module.cmake" # grouped modules
"${ITK_SOURCE_DIR}/*/*/*/*/itk-module.cmake" # sub-grouped modules (e.g., Remote/Analysis/TextureFeatures/)
)
foreach(f ${meta})
include(${ITK_SOURCE_DIR}/${f})
Expand Down
104 changes: 104 additions & 0 deletions CMake/ITKModuleRemote.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -389,3 +389,107 @@ function(itk_fetch_module _name _description)
endif()
endif()
endfunction()

# Download and enable a group of remote modules from a single repository.
#
# Unlike itk_fetch_module() which handles one module per repo, this function
# clones a category repository that contains multiple itk-module.cmake files
# in subdirectories. The module discovery glob in ITKModuleEnablement.cmake
# finds and registers each sub-module automatically.
#
# Usage in a .remote.cmake file:
# itk_fetch_module_group(Analysis
# "Analysis domain modules: TextureFeatures, BoneMorphometry, ..."
# GIT_REPOSITORY https://github.com/InsightSoftwareConsortium/ITKRemoteAnalysis.git
# GIT_TAG <commit-hash>
# )
#
# The group is controlled by ITKGroup_Remote_<name>. When the group option
# is ON, the repo is cloned into Modules/Remote/<name>/ and each sub-module
# becomes individually toggleable via Module_<sub-module>=ON/OFF.
#
# See https://github.com/InsightSoftwareConsortium/ITK/issues/6060
function(itk_fetch_module_group _group_name _description)
include(CMakeParseArguments)
cmake_parse_arguments(_fetch_options "" "GIT_REPOSITORY;GIT_TAG" "" ${ARGN})

# Create the group option if it doesn't exist yet.
if(NOT DEFINED ITKGroup_Remote_${_group_name})
option(
ITKGroup_Remote_${_group_name}
"Request building Remote/${_group_name} modules: ${_description}"
OFF
)
endif()

# Only fetch if the group is enabled (or the master Remote group is on)
if(NOT ITKGroup_Remote_${_group_name} AND NOT ITKGroup_Remote)
return()
endif()

if(ITK_FORBID_DOWNLOADS)
return()
endif()

itk_download_attempt_check(ITKGroup_Remote_${_group_name})
find_package(Git)
if(NOT GIT_EXECUTABLE)
message(FATAL_ERROR "error: could not find git for clone of ${_group_name}")
endif()

set(REMOTE_GIT_TAG "${_fetch_options_GIT_TAG}")

# Allow per-group tag override
if(
DEFINED
ITKGroup_Remote_${_group_name}_GIT_TAG
AND
NOT
"${ITKGroup_Remote_${_group_name}_GIT_TAG}"
STREQUAL
"${_fetch_options_GIT_TAG}"
)
set(REMOTE_GIT_TAG "${ITKGroup_Remote_${_group_name}_GIT_TAG}")
message(
STATUS
"NOTE: Using override 'ITKGroup_Remote_${_group_name}_GIT_TAG=${REMOTE_GIT_TAG}'"
)
endif()

# Freeze support
set(_group_dir "${ITK_SOURCE_DIR}/Modules/Remote/${_group_name}")
if(
ITK_FREEZE_REMOTE_MODULES
AND
EXISTS
"${_group_dir}"
AND
NOT
REMOTE_GIT_TAG
STREQUAL
""
)
message(
STATUS
"ITK_FREEZE_REMOTE_MODULES is ON: Skipping update of remote module group ${_group_name}"
)
return()
endif()

set(
ITKGroup_Remote_${_group_name}_GIT_TAG
"${REMOTE_GIT_TAG}"
CACHE STRING
"Override default GIT_TAG for remote module group ${_group_name}"
)
mark_as_advanced(ITKGroup_Remote_${_group_name}_GIT_TAG)

if(NOT REMOTE_GIT_TAG STREQUAL "")
_fetch_with_git(
"${GIT_EXECUTABLE}"
"${_fetch_options_GIT_REPOSITORY}"
"${REMOTE_GIT_TAG}"
"${_group_dir}"
)
endif()
endfunction()
50 changes: 0 additions & 50 deletions Modules/Remote/BoneEnhancement.remote.cmake

This file was deleted.

56 changes: 0 additions & 56 deletions Modules/Remote/BoneMorphometry.remote.cmake

This file was deleted.

16 changes: 16 additions & 0 deletions Modules/Remote/ITKRemoteAnalysis.remote.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# ITKRemoteAnalysis — consolidated remote module group
#
# Contains analysis-domain remote modules:
# TextureFeatures, BoneMorphometry, BoneEnhancement, Thickness3D,
# IsotropicWavelets, RANSAC, PerformanceBenchmarking, StructuralSimilarity
#
# Enable with: cmake -DITKGroup_Remote_Analysis=ON
# Individual modules toggleable via Module_<name>=ON/OFF
#
# See https://github.com/InsightSoftwareConsortium/ITK/issues/6060

itk_fetch_module_group(Analysis
"Analysis domain: TextureFeatures, BoneMorphometry, BoneEnhancement, Thickness3D, IsotropicWavelets, RANSAC, PerformanceBenchmarking, StructuralSimilarity"
GIT_REPOSITORY https://github.com/hjmjohnson/ITKRemoteAnalysis.git
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be helpful to bring these modules into the ITK repository. But not dump them in a different repository, which complicates ownership and maintenance. Or, create a Remote Module Group, that groups the individual repositories.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding them to the main repository would make sense too, especially for the more well established ones. If doing so, we would need to expand on the concept of "Review" module (which was the path to entering the main repository in the past), including building everything into python packages.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the remote modules for which we have strong evidence that only the core developers maintain them, I would 100% support bringing them into the ITK repository. That is an enormous maintenance burden relief! I understand the rationale behind the remote modules, but the implementation realities are that it is an extraordinary developer burden.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure why effort is being put into consolidating the modules into a single module without bring the modules into ITK. If the rationale that it is an extraordinary developer burdern for ITK developers to maintain all the ITK Remote Modules as Remote modules (and the assumption is that ITK core developers should maintain all Remote Modules, which I did not intend to be the case), then bring them into the ITK repository. Part of the rationale behind remote modules is that non-ITK core developers can create and maintain them outside the ITK repository. This is lost with such an ITKRemoteAnalysis repository.

GIT_TAG bf132a8671837090210b4714d5e184901becb24e
)
58 changes: 0 additions & 58 deletions Modules/Remote/IsotropicWavelets.remote.cmake

This file was deleted.

Loading
Loading