InsightSoftwareConsortium / ITKElastix

An ITK Python interface to elastix, a toolbox for rigid and nonrigid registration of images
Apache License 2.0
208 stars 22 forks source link

transformix_jacobian tries to use files #108

Open thewtex opened 3 years ago

thewtex commented 3 years ago

Also seems to be not working in itkTransformFilterTest.py, commented in #109

25:   File "itkTransformixFilterTest.py", line 51, in <module>
25:     jacobian = itk.transformix_jacobian(moving, parameters, log_to_console=True)
25:   File "/home/matt/bin/ITK-Wrap-Release/Wrapping/Generators/Python/itk/support/../ElastixPython.py", line 99, in transformix_jacobian
25:     det_spatial_jacobian = itk.imread('spatialJacobian.nii', itk.F)
25:   File "/home/matt/bin/ITK-Wrap-Release/Wrapping/Generators/Python/itk/support/itkExtras.py", line 692, in imread
25:     raise RuntimeError("No ImageIO is registered to handle the given file.")
25: RuntimeError: No ImageIO is registered to handle the given file.
25: itkTestDriver: Process exited with return value: 1
ViktorvdValk commented 3 years ago

This was indeed a very, quick temporal solution, since it wasn't a priority back then. But I'll now try to fix this issue in the itkTransformixFilter file in elastix.

ViktorvdValk commented 3 years ago

How is the python itk.elastix_registration_method() defined (how does it know which functions to call in order)? Is this automatically done with swig or is it defined as a c++ method like in SimpleElastix? In the swig case: What are the ruled for this automatic swig python wrapping? And in the SimpleElastix case: In which file is it defined? (I haven't found it so far)

thewtex commented 3 years ago

The itk.elastix_registration_method function is automatically generated from the itk::ElastixRegistrationMethod class. Indexed input's and output's to that class become the position args. The Set* methods become the kwargs (also supporting snake_case). For SimpleElastix, it was a different, involved manual process.

ViktorvdValk commented 3 years ago

And how are the internal function calls and the output of the function generated?

thewtex commented 3 years ago

E.g. https://github.com/InsightSoftwareConsortium/ITK/blob/9ff84420e55d2f86984f40f14861bddf0812b82b/Wrapping/Generators/Python/PyBase/pyBase.i#L280-L354

ViktorvdValk commented 3 years ago

@thewtex Where did you get this error? I can't reproduce it locally (windows and mac) nor on the CI

thewtex commented 3 years ago

@ViktorvdValk to reproduce the error, uncomment:

https://github.com/InsightSoftwareConsortium/ITKElastix/blob/30d2e9d9afacc25876fa5fc84842bae7d783cf6e/wrapping/test/itkTransformixFilterTest.py#L51-L53

ViktorvdValk commented 3 years ago

Yes, but that doesn't give me the error, not on the CI, nor on windows or mac. See https://github.com/InsightSoftwareConsortium/ITKElastix/compare/transformix_jacobian

thewtex commented 3 years ago

@ViktorvdValk interesting.. could a PR please be created to enable the test in CI, please?

thewtex commented 1 year ago

@N-Dekker has this been addressed with elastix 0.16.0?