Skip to content

BUG: Define GetOutput() for Python wrapping#40

Merged
thewtex merged 1 commit intomasterfrom
define-getoutput
Mar 16, 2020
Merged

BUG: Define GetOutput() for Python wrapping#40
thewtex merged 1 commit intomasterfrom
define-getoutput

Conversation

@thewtex
Copy link
Copy Markdown
Member

@thewtex thewtex commented Mar 13, 2020

Explicitly define GetOutput() for Python wrapping without the index and
with the ResultImageType as a return type.

Explicitly define GetOutput() for Python wrapping without the index and
with the ResultImageType as a return type.
@thewtex thewtex merged commit 6b89f41 into master Mar 16, 2020
@thewtex thewtex deleted the define-getoutput branch March 16, 2020 14:05
Copy link
Copy Markdown
Member

@romangrothausmann romangrothausmann left a comment

Choose a reason for hiding this comment

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

Changes look good, but so far I had no luck with getting this to work when used in an object-oriented python script, neither with a self-compiled debug version (https://gitlab.com/romangrothausmann/elastix_scripts/pipelines/127160739) nor with pip install (https://gitlab.com/romangrothausmann/elastix_scripts/pipelines/127159377).

The self-compiled debug version fails on cmake of ITKElastix with

CMake Error at /ITK/Wrapping/Generators/Python/CMakeLists.txt:3 (include_directories):
  include_directories given empty-string as include directory.

although things used to work here before #40 and use of ITK-5.1rc01.
The pip install version fails on execution with

    selx = itk.ElastixRegistrationMethod[rType, rType].New() # https://itkpythonpackage.readthedocs.io/en/latest/Quick_start_guide.html#instantiate-an-itk-object
  File "/usr/local/lib/python3.6/dist-packages/itkLazy.py", line 52, in __getattribute__
    itkBase.LoadModule(module, namespace)
  File "/usr/local/lib/python3.6/dist-packages/itkBase.py", line 93, in LoadModule
    module = loader.load(swigModuleName)
  File "/usr/local/lib/python3.6/dist-packages/itkBase.py", line 211, in load
    return importlib.import_module(name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/local/lib/python3.6/dist-packages/itk/Configuration/../ElastixPython.py", line 114, in <module>
    from itkElastixRegistrationMethodPython import *
  File "/usr/local/lib/python3.6/dist-packages/itk/Configuration/../itkElastixRegistrationMethodPython.py", line 1661, in <module>
    @itkHelpers.accept_numpy_array_like
AttributeError: module 'itkHelpers' has no attribute 'accept_numpy_array_like'

@thewtex
Copy link
Copy Markdown
Member Author

thewtex commented Mar 19, 2020

CMake Error at /ITK/Wrapping/Generators/Python/CMakeLists.txt:3 (include_directories):
include_directories given empty-string as include directory.

This is an issue in ITK 5.1 RC 2, and we will need ITK 5.1 RC 3 to continue.

@romangrothausmann
Copy link
Copy Markdown
Member

romangrothausmann commented Mar 19, 2020

Many thanks @thewtex for that info, I was expecting that it was an incomplete/false configuration in the DF. Looking forward to rc3 then;-)

While searching for a solution I stumbled over this:
weidai11/cryptopp#199

@romangrothausmann
Copy link
Copy Markdown
Member

In the meanwhile, @thewtex do you have an idea concerning the pip install failure? Is that related or a different issue for which I should open an issue for tracking?

@thewtex
Copy link
Copy Markdown
Member Author

thewtex commented Mar 27, 2020

pip install error are related current limitations of the pip dependency resolver -- it will no longer an issue once 5.1.0 is out.

@romangrothausmann
Copy link
Copy Markdown
Member

romangrothausmann commented Apr 22, 2020

Many thanks @thewtex for the update. I gave it a try with ITK-5.1rc03 and self-compiling ITKElastix but it seems elastix is not compatible with it:
https://gitlab.com/romangrothausmann/elastix_scripts/-/jobs/520141463

[ 28%] Building CXX object _deps/elastix_fetch-build/Components/Metrics/SumSquaredTissueVolumeDifferenceMetric/CMakeFiles/SumSquaredTissueVolumeDifferenceMetric.dir/elxSumSquaredTissueVolumeDifferenceMetric.cxx.o
17126 In file included from /ITKElastix_build/_deps/elastix_fetch-src/Core/ComponentBaseClasses/elxTransformBase.h:384:0,
17127                  from /ITKElastix_build/_deps/elastix_fetch-src/Core/Kernel/elxElastixTemplate.h:39,
17128                  from /ITKElastix_build/_deps/elastix_fetch-src/Core/Install/elxIncludes.h:39,
17129                  from /ITKElastix_build/_deps/elastix_fetch-src/Components/Interpolators/LinearInterpolator/elxLinearInterpolator.h:21,
17130                  from /ITKElastix_build/_deps/elastix_fetch-src/Components/Interpolators/LinearInterpolator/elxLinearInterpolator.cxx:19:
17131 /ITKElastix_build/_deps/elastix_fetch-src/Core/ComponentBaseClasses/elxTransformBase.hxx: In member function 'void itk::PixelTypeChangeCommand<T>::Execute(itk::Object*, const itk::EventObject&)':
17132 /ITKElastix_build/_deps/elastix_fetch-src/Core/ComponentBaseClasses/elxTransformBase.hxx:75:68: error: 'VECTOR' is not a member of 'itk::ImageIOBase'
17133      castcaller->GetModifiableImageIO()->SetPixelType( ImageIOBase::VECTOR );
17134                                                                     ^~~~~~
17135 /ITKElastix_build/_deps/elastix_fetch-src/Core/ComponentBaseClasses/elxTransformBase.hxx: In member function 'void itk::PixelTypeChangeCommand<T>::Execute(const itk::Object*, const itk::EventObject&)':
17136 /ITKElastix_build/_deps/elastix_fetch-src/Core/ComponentBaseClasses/elxTransformBase.hxx:83:68: error: 'VECTOR' is not a member of 'itk::ImageIOBase'
17137      castcaller->GetModifiableImageIO()->SetPixelType( ImageIOBase::VECTOR );
17138                                                                     ^~~~~~

Is that a known problem or should I open a new issue for that?

@hjmjohnson
Copy link
Copy Markdown
Member

hjmjohnson commented Apr 22, 2020

@romangrothausmann Are you building with ITK_LEGACY_REMOVE:BOOL=ON?

ImageIOBase::VECTOR is deprecated, and should be undefined if ITK_LEGACY_REMOVE:BOOL=ON.

see line 113 in itkImageIOBase.h for the defintion.

NOTE: Many duplicate enum values were consolidated and converted to class enum in Core/Common for ITK 5.1.

@romangrothausmann
Copy link
Copy Markdown
Member

Many thanks @hjmjohnson for your feedback. So far I did not have ITK_LEGACY_REMOVE:BOOL=ON, testing this now:
https://gitlab.com/romangrothausmann/elastix_scripts/-/jobs/522029016

@hjmjohnson
Copy link
Copy Markdown
Member

That’s weird.

ITK_LEGACY_REMOVE:BOOL=ON should break the build, not fixit.

ITK_LEGACY_REMOVE:BOOL=OFF should expose the old enumerations.

Hans

@dzenanz
Copy link
Copy Markdown
Member

dzenanz commented Apr 22, 2020

I guess we forgot to expose some of the deprecated enums under legacy flag.

@thewtex
Copy link
Copy Markdown
Member Author

thewtex commented Apr 24, 2020

I'll update to fix the enum's, and we will have nice-to-install packages after ITK 5.1.0 is out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants