I have been using ITK in the past and I recently started a python project. In this project I would like to use the MatchCardinalityImageToImageMetric metric. However, the metric has not been ported yet to python so I am trying to find out how this can be done.
I am new to ITK development so I am not sure I understand how to proceed and I would appreciate a bit of guidance.
This repository may be private (I cannot access the file), but since this class is already in ITK, you can contribute the wrapping configuration to its module wrapping directory. For more information on how to contribute a file, see our CONTRIBUTING.md.
It has been a while since my first post and in the meantime, thanks to Matt’s help, I managed to add the file itkMatchCardinalityImageToImageMetric.wrap to ITK-master/Modules/Registration/Common. I thought this was enough to make the metric available in python but when installing the last version of ITK (5.1.1 with pip) which contain the wrap file, the metric is not available. All other ITK components in the wrapping folder are working properly.
Can you help me figure out what I am missing to make this metric work in python?
Hi @bdepalle, thanks for your contribution!
Are you sure v5.1.1 contains the itkMatchCardinalityImageToImageMetric.wrap file?
I see it on master, but I don’t think it made it on time for v5.1.1. You could wait for the next update, or compile the wrappings yourself using the master branch.
I checked all requirement and I as far as I know, everything should be installed on my system. My python version is 3.6.9. Though the compilation crash with the following error:
-- Installing: /work/_skbuild/linux-x86_64-3.5/cmake-install/./itkLazy.py
-- Installing: /work/_skbuild/linux-x86_64-3.5/cmake-install/./itkHelpers.py
CMake Error at /work/ITK-cp35-cp35m-manylinux1_x64/Wrapping/Generators/Python/PyBase/cmake_install.cmake:41 (file):
file INSTALL cannot find
"/work/ITK-cp35-cp35m-manylinux1_x64/Wrapping/Generators/Python/itk/pyBasePython.py":
No such file or directory.
Call Stack (most recent call first):
/work/ITK-cp35-cp35m-manylinux1_x64/Wrapping/cmake_install.cmake:43 (include)
/work/ITK-cp35-cp35m-manylinux1_x64/cmake_install.cmake:804 (include)
ITKPythonPackage-build/cmake_install.cmake:105 (include)
cmake_install.cmake:41 (include)
FAILED: CMakeFiles/install.util
cd /work/_skbuild/linux-x86_64-3.5/cmake-build && /usr/bin/cmake -P cmake_install.cmake
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "/opt/python/cp35-cp35m/lib/python3.5/site-packages/skbuild/setuptools_wrap.py", line 551, in setup
cmkr.make(make_args, env=env)
File "/opt/python/cp35-cp35m/lib/python3.5/site-packages/skbuild/cmaker.py", line 482, in make
os.path.abspath(CMAKE_BUILD_DIR)))
An error occurred while building with CMake.
Command:
"cmake" "--build" "." "--target" "install" "--config" "Release" "--"
Source directory:
/work
Working directory:
/work/_skbuild/linux-x86_64-3.5/cmake-build
Please see CMake's output for more information.
+ exit 1
~/Documents/ITK/ITKPythonPackage
From what I understand, the file pyBasePython.py is missing but I have no clue where to get it from.
Do you have any suggestion?