Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python interface missing Get/SetNumberOfStreamingDivisions in ImageSink derived classes #977

Open
blowekamp opened this issue May 30, 2019 · 7 comments

Comments

Projects
None yet
3 participants
@blowekamp
Copy link
Member

commented May 30, 2019

With the ITK 5.0.0 Python wheel package, the GetNumberOfStreamDivisions and SetNumberOfStreamDivisions are not wrapped for classes such as StatisticsImageFilter, ImageToHistogramImageFilter, etc... derived from the ImageSink class.

In [30]: stats = itk.StatisticsImageFilter[ImageType].New()                                                                                                                                                                                                       

In [31]: stats.SetNumberOfStreamDivisions(2)                                                                                                                                                                                                                      
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-31-eb250864a9b0> in <module>
----> 1 stats.SetNumberOfStreamDivisions(2)

AttributeError: 'itkStatisticsImageFilterIUC3' object has no attribute 'SetNumberOfStreamDivisions'

@blowekamp

This comment has been minimized.

Copy link
Member Author

commented May 30, 2019

I'm not that familiar with the native ITK Python interface and it's mechanics. Maybe @fbudin69500 could lend a hand?

@dzenanz

This comment has been minimized.

Copy link
Member

commented May 30, 2019

The problem is probably that ImageSink is wrapped as a pointer, and not a regular class. So none of its members are wrapped either.

@blowekamp

This comment has been minimized.

Copy link
Member Author

commented May 30, 2019

The problem is probably that ImageSink is wrapped as a pointer, and not a regular class. So none of its members are wrapped either.

I think all filter are wrapped with that:
https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/wrapping/itkStreamingImageFilter.wrap#L1

I am wondering if these using statements are handled correctly:

using Superclass::SetNumberOfStreamDivisions;
using Superclass::GetNumberOfStreamDivisions;

@fbudin69500

This comment has been minimized.

Copy link
Contributor

commented May 30, 2019

@blowekamp : You are correct, all filters are wrapped as pointers. The problem is likely coming from what you suggested. It would be good to find another example of a filter wrapped in Python that has a similar implementation and see if the same problem arises.

@fbudin69500

This comment has been minimized.

Copy link
Contributor

commented May 30, 2019

Looking into the files generated by the Python wrapping process, I am inclined to think that the problem comes from CastXML, because in the XML description of this filter, this function is written as protected.

@blowekamp

This comment has been minimized.

Copy link
Member Author

commented May 30, 2019

The ImageToImageFilter::GetGlobalDefaultCoordinateTolerance is another method not available:

using ImageToImageFilterCommon::SetGlobalDefaultCoordinateTolerance;

@fbudin69500

This comment has been minimized.

Copy link
Contributor

commented May 30, 2019

Interesting. Thanks for pointing this one out. It is slightly different in the sense that one can access these functions by calling itk.ImageToImageFilterCommon.GetGlobalDefaultCoordinateTolerance(), and that the method is public in the original class, but it is not visible in the derived class (here, the base class is private).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.