Is MultiScaleHessianBasedMeasureImageFilter in python bindings?

Hello,

I need to use the MultiScaleHessianBasedMeasureImageFilter in python.

In the past I was using a compiled-by-me version of ITK with python bindings and my scripts were doing fine. I recently switched to the python package index version, which is much more convenient to update, especially since I’m not C++ or even CMake fluent.

However, it seems that my beloved filter is now missing:

AttributeError: module 'itk' has no attribute 'MultiScaleHessianBasedMeasureImageFilter'

Is this expected? Can I do something besides compiling ITK with all the mysterious flags again? Maybe use an older version from PyPI?

Hello @nicoco, :wave:

This is not present because MultiScaleHessianBasedMeasureImageFilter is in the ITKReview module. This patch moves it out of ITKReview:

http://review.source.kitware.com/#/c/23288/

After integrated, you can install the nightly build of the Python packages, and it will be available on PyPI and conda-forge after the ITK 5 release.

Hey @matt.mccormick,

Thanks for your answer.

If I understand correctly the information in the link you provided and what you meant by after integrated, I should be fine using the nightly builds:

Change 23288 - Merged

I’m asking because I’m now experiencing the world of pain of compiling and want to make sure I’m not doing this for nothing. :slight_smile:

FWIW, here’s where I’m stuck now:

$ python -m pip install itk --no-index -f \
    https://github.com/InsightSoftwareConsortium/ITKPythonPackage/releases/tag/latest
(...)
Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
(...)

…even though I installed doxygen through Fedora’s package manager (dnf) and also via conda-forge:

$ which doxygen
/opt/miniconda/envs/myenv/bin/doxygen
$ source deactivate
$ which doxygen
/usr/bin/doxygen

I know it’s useless to have it installed twice but meh, I’m just randomly trying things…

1 Like

I think your post hightlights two problems. For some reason there are problems with the latest tag. 1) It should download a precompiled version of ITK for your system, and if not, 2) it should compile the package.

  1. is a problem because even on my system, it doesn’t seem to find the matching precompiled package. This is a problem that needs to be investigated. When using tag v4.13.0 it works.
  2. I’ll see if on my computer this fails. I haven’t tried yet, but potentially there is a problem in the build script when trying to set doxygen's path.
1 Like

@fbudin Thank you for your answer.

Right now I’ve git cloned ITKPythonPackage, modified cmake/ITKPythonPackage.cmake to add set(DOXYGEN_EXECUTABLE "/usr/bin/doxygen"), launched python setup.py build and it seems to be compiling (33% right now). Even if I don’t end up with the filter I need this way, I’ll have understood some things about CMake. :wink:

1 Like

I did manage to install itk-4.13.0.dev20180325-py3.6-linux-x86_64 using the procedure I describe but unfortunately MultiScaleHessianBasedMeasureImageFilter still wasn’t there.

@matt.mccormick In which nightly build will it be present? Can I change build options somewhere in ITKPythonPackage to include ITKReview modules?

Thanks for your help, I’m really not familiar with how all of this (proper development, compiling, packaging…) works. :frowning:

:frowning: The build was just a few hours before the repository was updated. If you git pull in ITKPythonPackage now, it will use an ITK revision that contains the patch.

Eventually, you will be able to run

python setup.py bdist_wheel -- -DModule_ITKReview=ON

but we have to enable that feature ;-).

We are working towards ITK 5.0 Alpha 1, where we should have Python packages to try.

What you have accomplished already is very impressive! It is a continual learning process for everyone.

1 Like

Unfortunately it doesn’t build anymore :frowning:

[...]
 itkMirrorPadImageFilter: warning(4): ITK type not wrapped, or currently not known: itk::itkExponentialDecayHelper< false >
[...]
/home/ncedilni/src/ext/ITKPythonPackage/_skbuild/cmake-build/ITK-build/Wrapping/Typedefs/itkMirrorPadImageFilter.i:90: Warning 401: Nothing known about base class 'itk::itkExponentialDecayHelper< false >'. Ignored.
/home/ncedilni/src/ext/ITKPythonPackage/_skbuild/cmake-build/ITK-build/Wrapping/Typedefs/itkMirrorPadImageFilter.i:90: Warning 401: Maybe you forgot to instantiate 'itk::itkExponentialDecayHelper< false >' using %template.
/home/ncedilni/src/ext/ITKPythonPackage/_skbuild/cmake-build/ITK-build/Wrapping/Typedefs/itkMirrorPadImageFilter.i:139: Warning 401: Nothing known about base class 'itk::itkExponentialDecayHelper< false >'. Ignored.
(a lot of these)
[...]
gmake[5]: *** [Wrapping/Modules/ITKImageGrid/CMakeFiles/ITKImageGridPython.dir/build.make:373: Wrapping/Modules/ITKImageGrid/itkMirrorPadImageFilterPython.cpp] Error 52
gmake[5]: *** Deleting file 'Wrapping/Modules/ITKImageGrid/itkMirrorPadImageFilterPython.cpp'
gmake[4]: *** [CMakeFiles/Makefile2:16862: Wrapping/Modules/ITKImageGrid/CMakeFiles/ITKImageGridPython.dir/all] Error 2
gmake[3]: *** [Makefile:152: all] Error 2
gmake[2]: *** [CMakeFiles/ITK.dir/build.make:111: ITK-prefix/src/ITK-stamp/ITK-build] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/ITK.dir/all] Error 2
gmake: *** [Makefile:118: all] Error 2
Traceback (most recent call last):
  File "/opt/ncedilni/miniconda3.6/envs/vtscan/lib/python3.6/site-packages/skbuild/setuptools_wrap.py", line 409, in setup
    cmkr.make(make_args, env=env)
  File "/opt/ncedilni/miniconda3.6/envs/vtscan/lib/python3.6/site-packages/skbuild/cmaker.py", line 417, in make
    os.path.abspath(CMAKE_BUILD_DIR)))

An error occurred while building with CMake.
  Command:
    "cmake" "--build" "." "--target" "install" "--config" "Release" "--"
  Source directory:
    /home/ncedilni/src/ext/ITKPythonPackage
  Working directory:
    /home/ncedilni/src/ext/ITKPythonPackage/_skbuild/cmake-build
Please see CMake's output for more information.

I guess this is why it is better to stick to releases… but I also tried to build ITK 4.13.0 with the ITKReview module and python wrapping enabled and:

[...]
[ 57%] Building CXX object Wrapping/Modules/ITKCommon/CMakeFiles/ITKCommonExplicit.dir/__/__/itkOffsetExplicit.cxx.o
In file included from /home/ncedilni/src/ext/build20180327/Wrapping/Typedefs/ITKCommonExplicit.h:12:0,
                 from /home/ncedilni/src/ext/build20180327/Wrapping/itkOffsetExplicit.cxx:2:
/home/ncedilni/src/ext/ITK-4.13.0/Modules/Core/Common/include/itkOffset.h: In instantiation of ‘static itk::Offset<VOffsetDimension> itk::Offset<VOffsetDimension>::GetBasisOffset(unsigned int) [with unsigned int VOffsetDimension = 2]’:
/home/ncedilni/src/ext/build20180327/Wrapping/itkOffsetExplicit.cxx:4:47:   required from here
/home/ncedilni/src/ext/ITK-4.13.0/Modules/Core/Common/include/itkOffset.h:260:9: error: ‘memset’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
   memset(ind.m_Offset, 0, sizeof( OffsetValueType ) * VOffsetDimension);
   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/7/cstring:42:0,
                 from /home/ncedilni/src/ext/ITK-4.13.0/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_matrix_fixed.h:29,
                 from /home/ncedilni/src/ext/ITK-4.13.0/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_matrix_fixed.hxx:9,
                 from /home/ncedilni/src/ext/ITK-4.13.0/Modules/Core/Common/include/itkMatrix.h:28,
                 from /home/ncedilni/src/ext/ITK-4.13.0/Modules/Core/Common/include/itkSymmetricSecondRankTensor.h:28,
                 from /home/ncedilni/src/ext/build20180327/Wrapping/Typedefs/ITKCommonExplicit.h:21,
                 from /home/ncedilni/src/ext/build20180327/Wrapping/itkOffsetExplicit.cxx:2:
/usr/include/string.h:60:14: note: ‘void* memset(void*, int, size_t)’ declared here, later in the translation unit
 extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
              ^~~~~~
In file included from /home/ncedilni/src/ext/build20180327/Wrapping/Typedefs/ITKCommonExplicit.h:12:0,
                 from /home/ncedilni/src/ext/build20180327/Wrapping/itkOffsetExplicit.cxx:2:
/home/ncedilni/src/ext/ITK-4.13.0/Modules/Core/Common/include/itkOffset.h: In instantiation of ‘static itk::Offset<VOffsetDimension> itk::Offset<VOffsetDimension>::GetBasisOffset(unsigned int) [with unsigned int VOffsetDimension = 3]’:
/home/ncedilni/src/ext/build20180327/Wrapping/itkOffsetExplicit.cxx:5:47:   required from here
/home/ncedilni/src/ext/ITK-4.13.0/Modules/Core/Common/include/itkOffset.h:260:9: error: ‘memset’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
   memset(ind.m_Offset, 0, sizeof( OffsetValueType ) * VOffsetDimension);
   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/7/cstring:42:0,
                 from /home/ncedilni/src/ext/ITK-4.13.0/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_matrix_fixed.h:29,
                 from /home/ncedilni/src/ext/ITK-4.13.0/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_matrix_fixed.hxx:9,
                 from /home/ncedilni/src/ext/ITK-4.13.0/Modules/Core/Common/include/itkMatrix.h:28,
                 from /home/ncedilni/src/ext/ITK-4.13.0/Modules/Core/Common/include/itkSymmetricSecondRankTensor.h:28,
                 from /home/ncedilni/src/ext/build20180327/Wrapping/Typedefs/ITKCommonExplicit.h:21,
                 from /home/ncedilni/src/ext/build20180327/Wrapping/itkOffsetExplicit.cxx:2:
/usr/include/string.h:60:14: note: ‘void* memset(void*, int, size_t)’ declared here, later in the translation unit
 extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
              ^~~~~~
In file included from /home/ncedilni/src/ext/build20180327/Wrapping/Typedefs/ITKCommonExplicit.h:12:0,
                 from /home/ncedilni/src/ext/build20180327/Wrapping/itkOffsetExplicit.cxx:2:
/home/ncedilni/src/ext/ITK-4.13.0/Modules/Core/Common/include/itkOffset.h: In instantiation of ‘static itk::Offset<VOffsetDimension> itk::Offset<VOffsetDimension>::GetBasisOffset(unsigned int) [with unsigned int VOffsetDimension = 4]’:
/home/ncedilni/src/ext/build20180327/Wrapping/itkOffsetExplicit.cxx:6:47:   required from here
/home/ncedilni/src/ext/ITK-4.13.0/Modules/Core/Common/include/itkOffset.h:260:9: error: ‘memset’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
   memset(ind.m_Offset, 0, sizeof( OffsetValueType ) * VOffsetDimension);
   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/7/cstring:42:0,
                 from /home/ncedilni/src/ext/ITK-4.13.0/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_matrix_fixed.h:29,
                 from /home/ncedilni/src/ext/ITK-4.13.0/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_matrix_fixed.hxx:9,
                 from /home/ncedilni/src/ext/ITK-4.13.0/Modules/Core/Common/include/itkMatrix.h:28,
                 from /home/ncedilni/src/ext/ITK-4.13.0/Modules/Core/Common/include/itkSymmetricSecondRankTensor.h:28,
                 from /home/ncedilni/src/ext/build20180327/Wrapping/Typedefs/ITKCommonExplicit.h:21,
                 from /home/ncedilni/src/ext/build20180327/Wrapping/itkOffsetExplicit.cxx:2:
/usr/include/string.h:60:14: note: ‘void* memset(void*, int, size_t)’ declared here, later in the translation unit
 extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
              ^~~~~~
In file included from /home/ncedilni/src/ext/build20180327/Wrapping/Typedefs/ITKCommonExplicit.h:12:0,
                 from /home/ncedilni/src/ext/build20180327/Wrapping/itkOffsetExplicit.cxx:2:
/home/ncedilni/src/ext/ITK-4.13.0/Modules/Core/Common/include/itkOffset.h: In instantiation of ‘static itk::Offset<VOffsetDimension> itk::Offset<VOffsetDimension>::GetBasisOffset(unsigned int) [with unsigned int VOffsetDimension = 1]’:
/home/ncedilni/src/ext/build20180327/Wrapping/itkOffsetExplicit.cxx:7:47:   required from here
/home/ncedilni/src/ext/ITK-4.13.0/Modules/Core/Common/include/itkOffset.h:260:9: error: ‘memset’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
   memset(ind.m_Offset, 0, sizeof( OffsetValueType ) * VOffsetDimension);
   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/7/cstring:42:0,
                 from /home/ncedilni/src/ext/ITK-4.13.0/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_matrix_fixed.h:29,
                 from /home/ncedilni/src/ext/ITK-4.13.0/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_matrix_fixed.hxx:9,
                 from /home/ncedilni/src/ext/ITK-4.13.0/Modules/Core/Common/include/itkMatrix.h:28,
                 from /home/ncedilni/src/ext/ITK-4.13.0/Modules/Core/Common/include/itkSymmetricSecondRankTensor.h:28,
                 from /home/ncedilni/src/ext/build20180327/Wrapping/Typedefs/ITKCommonExplicit.h:21,
                 from /home/ncedilni/src/ext/build20180327/Wrapping/itkOffsetExplicit.cxx:2:
/usr/include/string.h:60:14: note: ‘void* memset(void*, int, size_t)’ declared here, later in the translation unit
 extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
              ^~~~~~
make[2]: *** [Wrapping/Modules/ITKCommon/CMakeFiles/ITKCommonExplicit.dir/build.make:639: Wrapping/Modules/ITKCommon/CMakeFiles/ITKCommonExplicit.dir/__/__/itkOffsetExplicit.cxx.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:39148: Wrapping/Modules/ITKCommon/CMakeFiles/ITKCommonExplicit.dir/all] Error 2
make: *** [Makefile:163: all] Error 2

As usual, any tip is appreciated.

Oops – it looks like a recent change broke the build. You could try git checkout 0aed418b04c999bb9, which is the update from the previous day that was building on the software quality dashboard.

And we will fix master:blush:

When improving the mirror pad filter I totally forgot about wrapping.

A patch has been submitted, but its fate might not be decided until Friday.