Closed aylward closed 2 months ago
Thanks for your pull request @aylward It would be very disappointing if SWIG would still not support pass by reference or return by reference. I still hope that it can be enabled somehow. For pass by reference, StackOverflow Swig: How to wrap double& (double passed by reference)? suggested %include <typemaps.i>
and some %apply
statement. Did you already try that out?
@N-Dekker - I saw the same stackoverflow post, but I didn't pursue it because it changes the signature of the function when wrapping - causing the wrapped API to not match the C++ API. I didn't care for that break in philosophy compared to the rest of ITK's wrapping.
I am going to close this pull request and make another that contains only changes for the necessary Get statements. This pull request had other changes to make a consistent API (offering non-get versions of every function, even if the original wrapped as-is). Instead I'll reduce to the minimal changes for simplicity. I'll also mark the non-standard return by reference as functions to be deprecated. Stay tuned...
The dictionary used by SpatialObjectProperties is queried using a function that returns the dictionary value in a variable that is passed by reference: https://itk.org/Doxygen/html/classitk_1_1SpatialObjectProperty.html#aff2b1c659a8e77bdb6afeef0bab037fb
This function is not correctly wrapped by SWIG, and cannot be used from within python.
Here is a snippet of code that demonstrates the issue:
This commit adds new functions that can be correctly wrapped. Old functions are unmodified to preserve backward compatibility.