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: Set Seeds as conntainer objects #4793

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

Conversation

blowekamp
Copy link
Member

Best practices are to set member variables as object, and not repeat accessor methods in the interface of the owning object e.g. AddSeed, ClearSeed.

PR Checklist

  • No API changes were made (or the changes have been approved)
  • No major design changes were made (or the changes have been approved)
  • Added test (or behavior not changed)
  • Updated API documentation (or API not changed)
  • Added license to new files (if any)
  • Added Python wrapping to new files (if any) as described in ITK Software Guide Section 9.5
  • Added ITK examples for all new major features (if any)

Refer to the ITK Software Guide for
further development details if necessary.

Best practices are to set member variables as object, and not repeat
accessor methods in the interface of the owning object e.g. AddSeed,
ClearSeed.
@github-actions github-actions bot added type:Enhancement Improvement of existing methods or implementation area:Segmentation Issues affecting the Segmentation module labels Aug 1, 2024
@blowekamp
Copy link
Member Author

@jhlegarreta I was surprised to see SetSeed[12] marked as deprecated in some documentation changes made in #3866. d58bf56

These were the quick changes I made to have the seeds list behave like objects with setter/getters. Further investigation found other region growing filters with similar interfaces:

  • ConfidenceConnectedImageFilter
  • ConnectedThresholdImageFilter
  • NeighborhoodConnectedImageFilter
  • VectorConfidenceConnectedImageFilter
    They all have AddSeed, ClearSeeds, methods. Some have the "SetSeed" method marked as deprecated in the doxygen. I didn't see any with a get method for the seed list.

These classes seem to use std::vector to hold the seed lists. Perhaps performance was a reason for this approach? Modern C++ could do something like filter->SetSeedList(std::move(my_list)) where the data could be moved and not copied.

What can be done to improve the interface of these filters and make them more consistent?

Copy link
Member

@jhlegarreta jhlegarreta left a comment

Choose a reason for hiding this comment

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

Really sorry @blowekamp, looks like I was confused by the docstring in the implementation file, which documented the method as being deprecated:
d58bf56#diff-9daea1a5d3498baf38e16ef9fd06da89d2f898c4b599a7eb287a76fc3a720accL105
d58bf56#diff-9daea1a5d3498baf38e16ef9fd06da89d2f898c4b599a7eb287a76fc3a720accL137

But after investigation, I now see that the documentation was not updated and the passage left inadvertently in
c005b54

So please, go ahead and update the documentation.

If possible, can the methods be tested, please?

void
AddSeed2(const IndexType & seed);

/** Set a single seed point 2.
*
* This seed will be isolated from Seed1 (if possible).
*
* \deprecated Please use AddSeed2.
* \deprecated Please use SetSeed2.
Copy link
Member

Choose a reason for hiding this comment

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

This should then say SetSeeds2.

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

Successfully merging this pull request may close these issues.

2 participants