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

feat(filter): Add contour loop extraction filter #3003

Merged
merged 3 commits into from Feb 8, 2024

Conversation

sedghi
Copy link
Contributor

@sedghi sedghi commented Jan 30, 2024

Context

  • Thanks to @floryst for providing me the contourLoopExtraction code, I am just providing an example, as well as typing and submitting a pull request.

This PR introduces the vtkContourLoopExtraction filter, which is designed to extract closed loop contours from the output of the vtkPolyData.

Unlike tools like vtkCutter, which lack sufficient clustering information about the cuts, vtkContourLoopExtraction efficiently traverses the points to identify loops.

Results

I've included an example that demonstrates this amazing feature. In this particular example, we obtain the output of the vtkCutter and then pass it to the vtkContourLoopExtraction. Finally, we generate separate polyData for each individual contour, with each contour having its own unique color.

vtk.mp4

Changes

  • Documentation and TypeScript definitions were updated to match those changes

PR and Code Checklist

  • semantic-release commit messages
  • Run npm run reformat to have correctly formatted code

Testing

  • This change adds or fixes unit tests
  • Tested environment:
    • vtk.js: Latest
    • OS: macOS
    • Browser: Chrome latest stable

Co-authored-by: Forrest Li <forrest.li@kitware.com>
Copy link
Collaborator

@floryst floryst left a comment

Choose a reason for hiding this comment

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

Just 2 more cosmetic changes. This will be good to go afterwards!

const outLines = output.getLines();
outLines.resize(0);

// Optional merging of contours can happen here
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can drop this comment, since it's not implemented.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Sources/Filters/General/ContourLoopExtraction/index.js Outdated Show resolved Hide resolved
@sedghi
Copy link
Contributor Author

sedghi commented Feb 8, 2024

@floryst Would it be possible for you to re-review this?

@floryst
Copy link
Collaborator

floryst commented Feb 8, 2024

LGTM! Thanks!

@floryst floryst added this pull request to the merge queue Feb 8, 2024
Merged via the queue into Kitware:master with commit 9bd65c6 Feb 8, 2024
3 checks passed
Copy link

github-actions bot commented Feb 8, 2024

🎉 This PR is included in version 29.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot added the released Automated label label Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Automated label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants