ITKElastix icon indicating copy to clipboard operation
ITKElastix copied to clipboard

transformix_jacobian tries to use files

Open thewtex opened this issue 4 years ago • 10 comments

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

thewtex avatar Feb 23 '21 22:02 thewtex

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 avatar Feb 24 '21 09:02 ViktorvdValk

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)

ViktorvdValk avatar Feb 24 '21 13:02 ViktorvdValk

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.

thewtex avatar Feb 24 '21 14:02 thewtex

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

ViktorvdValk avatar Feb 24 '21 14:02 ViktorvdValk

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

thewtex avatar Feb 24 '21 16:02 thewtex

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

ViktorvdValk avatar Mar 03 '21 13:03 ViktorvdValk

@ViktorvdValk to reproduce the error, uncomment:

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

thewtex avatar Mar 09 '21 18:03 thewtex

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

ViktorvdValk avatar Mar 15 '21 13:03 ViktorvdValk

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

thewtex avatar Mar 15 '21 23:03 thewtex

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

thewtex avatar Feb 15 '23 11:02 thewtex