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

ENH: KernelTransform's PointSet should use minimal point data #4526

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dzenanz
Copy link
Member

@dzenanz dzenanz commented Mar 18, 2024

This data is not used, so it is better to have a lighter-weight char, instead of the heavier PointType there. Having PointType there might also confuse someone into thinking that point coordinates should be provided there, or might be retrieved from it.

PR Checklist

This data is not used, so it is better to have a lighter-weight char,
instead of the heavier PointType there.
Having PointType there might also confuse someone into thinking that
point coordinates should be provided there, or might be retrieved from it.
@github-actions github-actions bot added type:Enhancement Improvement of existing methods or implementation area:Core Issues affecting the Core module labels Mar 18, 2024
@dzenanz dzenanz marked this pull request as ready for review March 19, 2024 13:09
@dzenanz dzenanz requested a review from N-Dekker March 19, 2024 15:43
Comment on lines +119 to +123
#ifdef ITK_FUTURE_LEGACY_REMOVE
using PointSetType = PointSet<unsigned char, VDimension, PointSetTraitsType>;
#else
using PointSetType = PointSet<InputPointType, VDimension, PointSetTraitsType>;
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally you would use PointSet<void, VDimension, PointSetTraitsType>, right?

For what it's worth, I noticed that sizeof(PointSet<unsigned char>) == sizeof(PointSet<long long>), so for the size it does not really seem to matter.

Do you have an idea why KernelTransform doesn't simply use an std::vector of points?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PointSet<void, VDimension, PointSetTraitsType> does not compile, unfortunately. That was my first idea 😄

Do you have an idea why KernelTransform doesn't simply use an std::vector of points?

Maybe to make it more convenient to cooperate with meshes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sizeof(PointSet<>) is unaffected, as it is independent of data associated with each point.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe to make it more convenient to cooperate with meshes?

Possible 🤔 But then, would your change break old use cases of cooperation with meshes of the original "point data" type?

I'm not opposed to this PR, I'm just curious. I see that that "point data type" can be problematic.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before this PR, there were two places for PointType (i.e. point coordinates). One which was envisioned for it (in PointsContainer) and another one in PointDataContainer, which was envisioned for other things (such as point color, intensity, importance, whatever). This PR changes PointData to be an unsigned char.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sizeof(PointSet) == sizeof(PointSet), so for the size it does not really seem to matter.

This does seem potentially disruptive without convincing benefit if there is not a size difference and the point data is not allocated. I am not sure what unsigned char would be used for. I could see a use case for putting the transform points in the PointData.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, KernelTransform ignores the "associated data" of the PointSet. So ideally, it should support any type of PointSet, independent of its "associated data". Right? Just asking, for my understanding.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is a use case for supporting any type with the Kernel Transform, then the point set or its pixel type would need to be a template parameter. But I am not seeing that use case, at least in any tests in this patch. And the change would not be to always unsigned char.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:Core Issues affecting the Core module type:Enhancement Improvement of existing methods or implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants