cornerstone3D icon indicating copy to clipboard operation
cornerstone3D copied to clipboard

feat(brush): update data only once when Brush interaction is done

Open sedghi opened this issue 2 years ago • 3 comments

Context

Segmentation Export

Make the generateSegmentation function to return the segmentation dataset instead of the arraybuffer since one might need to push it to the server

Brush Tool

Previously the brush tool modifications/interaction were updating the scalarData and triggering the segmentaion_data_modified A LOT, which is not performance optimized and later when we add the history undo/redo we will end up with problems (since each transaction should be undo/redoable not the whole drag). This PR will show an intermediate step showing the brush locations (similar to volview and 3D Slicer) and when the mouse up happens it does the scalar data update, we call this lazyCalculation

Brush Tool size

Previously the brush tool size was in canvas, which means that when you zoomed in the image the brush size would become smaller which is unexpected by the user. This PR changes it to the world coordinates in mm units

Before

https://github.com/cornerstonejs/cornerstone3D/assets/7490180/bafebec1-1886-4b2f-a8a1-e9b95de88c2d

Now

https://github.com/cornerstonejs/cornerstone3D/assets/7490180/13aad39f-7ff5-4904-9c02-775096ef4863

Testing

Test it in the labelmapsegmentationtools example

https://deploy-preview-762--cornerstone-3d-docs.netlify.app/live-examples/labelmapsegmentationtools

Checklist

PR

  • [] My Pull Request title is descriptive, accurate and follows the semantic-release format and guidelines.

Code

  • [] My code has been well-documented (function documentation, inline comments, etc.)

  • [] I have run the yarn build:update-api to update the API documentation, and have committed the changes to this PR. (Read more here https://www.cornerstonejs.org/docs/contribute/update-api)

Public Documentation Updates

  • [] The documentation page has been updated as necessary for any public API additions or removals.

Tested Environment

  • [] "OS:
  • [] "Node version:
  • [] "Browser:

sedghi avatar Aug 30 '23 17:08 sedghi

Deploy Preview for cornerstone-3d-docs ready!

Name Link
Latest commit 3b7c03888e2e5747166c2399d3de17e4113f5d01
Latest deploy log https://app.netlify.com/sites/cornerstone-3d-docs/deploys/64f74eb03c5afe0008cac488
Deploy Preview https://deploy-preview-762--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 configuration.

netlify[bot] avatar Aug 30 '23 17:08 netlify[bot]

I'm closing this for now (continuing here https://github.com/cornerstonejs/cornerstone3D/pull/771)

The reason is that there will be a sever performance drop for the sphere tool (as we are filling inside all spheres one by one, and that blocks the UI and has bad user experience)

I guess for the historyAPI we should tag each data modified with an id of the transaction. Or we should take a look at how to capture the convex hull of set of spheres, which I won't do for now

sedghi avatar Sep 05 '23 21:09 sedghi

Re-opening since we need this for the history API, and we have a good web worker api right now to put stuff there

sedghi avatar Feb 02 '24 17:02 sedghi