Open thewtex opened 1 month ago
@thewtex I'm glad you are looking at this issue. Is the following supposed to work well?
output_image = itk.median_image_filter(input=my_float_image)
(It now says TypeError: Expecting argument of type itkImageSS2 or itkImageSourceISS2). Or should the keyword argument start with a capital, Input=my_float_image
? I'm asking, because "Input" is in the list of so-called primary_input_methods
at:
And primary_input_methods
is used for dispatching:
Regarding ITKElastix issue https://github.com/InsightSoftwareConsortium/ITKElastix/issues/212, obviously, "FixedImage" and "MovingImage" are not in primary_input_methods
(and neither are "fixed_image" and "moving_image"). So I guess primary_input_methods
should be extended, right?
The Process object maintains a lists of index inputs and named inputs. And a named input can be marked as primary. These named inputs are already coded input many filters e.g. PDEDeformableRegistrationFilter
The information in the Process object should likely be used.
Thanks @blowekamp I see, PDEDeformableRegistrationFilter has inputs named "FixedImage" and "MovingImage":
So then, should something like the following work, for itk::Image<float>
objects float_image1
and float_image2
?
itk.pde_deformable_registration_filter(FixedImage=float_image1, MovingImage=float_image2)
(It now says TypeError: Expecting argument of type itkImageSS2 or itkImageSourceISS2)
In procedural interface, the parameters get converted to snake_case
, so try this: itk.pde_deformable_registration_filter(fixed_image=float_image1, moving_image=float_image2)
.
I would expect ProcessObject::GetPrimaryInputName to be useful.
I am not too sure of these details in ITK Python. Specifically if the Process object's name inputs/outputs are used or if it's just mapping keyword arguments to methods.
Also I think that PDE deformable registration class may be a base class for the deacons methods, and I have a harder guess of which is the primary input, and how the template parameters get mapped from it.
Is the following supposed to work well?
output_image = itk.median_image_filter(input=my_float_image)
The keyword here to be supported would be the snake_case version of itk::MedianImageFilter::GetPrimaryInputName()
;
We should dispatch on PrimaryInputName when it is passed as a keyword argument instead of a positional parameter.
xref:
CC: @N-Dekker @mstaring