Update remote module in ITK


just a question regarding the updates of remote modules in ITK.

I have a remote module in ITK. The *.remote.cmake points to the * github repo. Initially ITK load the files from the remote repo and build the remote module like the other modules.

If I change something inside the remote module (not using the ITK solution but another solution because I dont want to handle the large ITK solution) the changes are pushed on the remote github repo.
How do I update the remote module in ITK correctly?
Does the ITK check if remote modules have changed?

Currently I push my changes to the remote and change in to the local remote directory of ITK. From this directory I use git pull to update the code in this directory. Afterwards I build the remote module using the ITK solution.

Each remote module has its own *.remote.cmake file, e.g. this one:

The way to update a remote module in ITK is to update the hash in the corresponding file.

There is REMOTE_GIT_TAG_Thickness3D CMake variable in ITK’s configuration. This gets initialized at the time a remote module is enabled. If you delete it, it will be reinitialized again based on the hash in the file. The hash provided here overrides the one in the file - this is quite useful when making changes to the remote module.

There is also UpdateRemoteModules.sh which updates all the remote modules to the current version if they pass their tests. One of the maintainers runs this script every once in a while, to make sure we are using up-to-date versions of remote modules.


Another option, which work best when developing a module or making many changes, is to build the module externally.

For example, to build the Thickness3D module externally, first build ITK. In ITK’s build configuration do not enable Module_Thickness3D.

git clone https://github.com/InsightSoftwareConsortium/ITK
mkdir ITK-build
cd ITK-build
cmake ../ITK

Then, build the module as a separate project against ITK:

git clone https://github.com/InsightSoftwareConsortium/ITKThickness3D/
mkdir ITKThickness3D-build
cd ITKThickness3D-build
cmake -DITK_DIR=${PWD}/../ITK-build ../ITKThickness3D
1 Like

@dzenanz Thank you for the tip with UpdateRemoteModules.sh . I did not recognize the existence of this tool.

In my *.remote.cmake file the GIT_TAG is set to master therefore I guessed that it will update itself or do I still have to run UpdateRemoteModules.sh to replace the tag with the actual hash value?

You don’t have to run UpdateRemoteModules.sh, but I guess you do need an occasional pull. I am not sure how frequently the pulls are done, and if they are even done by the ITK CMake code after the initial clone.

I’m trying to incorporate some of the changes recently made to the remote module ITKRLEImage. How can I determine the current GIT_TAG? I have run UpdateRemoteModules.sh and disabled and enabled the module in ccmake, but this was still not updated.

@melrobin to use or make changes to a remote module, the best approach is to build it externally, as described above.

To check the version of a remote checked out with via ITK’s CMake configure, you can examine the Git repository at ITK/Modules/Remote/<ModuleName>, e.g.

cd ITK/Modules/Remote/RLEImage
git rev-parse HEAD