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(contour): improved performance and better configuration #543

Merged
merged 10 commits into from
Apr 5, 2023

Conversation

sedghi
Copy link
Member

@sedghi sedghi commented Apr 5, 2023

Improved performance for updating contours and centroid calculations
To test: run https://deploy-preview-543--cornerstone-3d-docs.netlify.app/live-examples/contourrenderingconfiguration

  • refactor: Update contour rendering default configuration & remove console.debug call
  • perf: Optimize getting and setting vtk polydata for contour sets
  • refactor(displayTools): optimize contour sets rendering with segment specific configs
  • refactor: Remove redundant code for Contour display tools
  • feat: add computation for centroid of the contour set
  • refactor: simplify centroid calculation for better contour rendering

sedghi added 8 commits April 3, 2023 16:15
…sole.debug call

This commit updates the Contour rendering settings to a more visually pleasing default configuration with a thinner active outline and a solid fill enabled. It also removes a `console.debug` call in the `removeSegmentationsFromToolGroup` function that is no longer needed.
This commit refactors the `ContourSet` and `IContourSet` interfaces to include a new `getPolyData()` and `setPolyData()` function to get and set the vtk polydata object associated with the contour set for caching purposes. This allows improved performance when repeatedly accessing the polydata. Additionally, optimizations made to `updateContourSets()` ensure better and more consistent rendering of color and visibility updates. There is also cleanup of unused imports and variables.
…specific configs

Replace unnecessary loops with reduce function to create an accumulator holding the contour sets and segment specific configs. Then, process the contour sets and apply visibility updates according to any affected segments or custom segment settings that have a fillAlpha attribute.
This commit removes redundant code that has been replaced with simpler alternatives for adding contour sets to an element and updating contours sets in Contour display tools.
This commit adds functionality to compute the centroid of a contour set. The centroid is calculated as a weighted average of all the contour points. Limitations are noted in the code. A new public function, `getCentroid()`, has also been added to retrieve the centroid.
Instead of calculating the centroid of all points in a ContourSet, this restructured logic picks the point closest to the centroid, as the centroid calculation can sometimes cause contours to be rendered incorrectly or not at all. Removed unused import vtkAppendPolyData.

fix: increase outline width of active contours

This change increases the outline width of active contours from 1 to 2 in contourConfig, for better visibility.
@netlify
Copy link

netlify bot commented Apr 5, 2023

Deploy Preview for cornerstone-3d-docs ready!

Name Link
🔨 Latest commit 4fe7ab8
🔍 Latest deploy log https://app.netlify.com/sites/cornerstone-3d-docs/deploys/642da01deff24500084f7f4b
😎 Deploy Preview https://deploy-preview-543--cornerstone-3d-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Collaborator

@jbocce jbocce left a comment

Choose a reason for hiding this comment

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

Looks good @sedghi. Minor docs changes. Approved.

packages/core/src/cache/classes/ContourSet.ts Outdated Show resolved Hide resolved
packages/core/src/cache/classes/ContourSet.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@jbocce jbocce left a comment

Choose a reason for hiding this comment

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

Approved...again 😊

@sedghi sedghi changed the title feat(contour): improved performance and better configuratoin feat(contour): improved performance and better configuration Apr 5, 2023
@sedghi sedghi merged commit c69c58a into main Apr 5, 2023
@sedghi sedghi deleted the fix/rtss-ohif branch August 2, 2023 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants