Closed tbirdso closed 3 years ago
@thewtex @dzenanz Could you add insight as to how pointer arguments might be causing issues in Python here? Is it likely an issue with the module wrapping, or a symptom of a different root cause?
In 2018, mesh support in Python was deficient (https://github.com/InsightSoftwareConsortium/ITKExamples/pull/66). Maybe not everything has been updated properly in ITK? If you try updating the example in https://github.com/InsightSoftwareConsortium/ITKExamples/pull/66 maybe you could get a better grip of mesh support. Trying it out on a simple, stand-alone example should be helpful for this custom filter.
I'll check it out, thanks!
@tbirdso The SetInput
method currently has a Mesh SmartPointer as its argument:
This needs to be a raw pointer instead of a SmartPointer. Passing a smart pointer causes unnecessary smart pointer construction / destruction, and wrapping and wrapping ownership rules are set up for raw pointers.
Thanks @thewtex. I wasn't understanding that Pointer = SmartPointer< Self >
, but now I see that in the itk::Object
documentation as well.
I found Cpp guidelines to help myself better understand the issue with this design pattern: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-smart
Overview
MeshProcrustesAlignFilter builds and is wrapped successfully for template arguments of type itk::Mesh<double, 3>. However, attempting to set input meshes in Python following setting number of inputs returns an error:
At face value it seems that there is a type mismatch between the expected argument of type
itkMeshD3_Pointer
and the given value of typeitkMeshD3
. However, per Discourse discussion Python is not expected to handle pointers directly.Steps to Reproduce
Expected behavior
Setting inputs up to the allocated number in Step 3 succeeds without error.
Observed behavior