Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to trigger a tool recalculation after 'addToolState' for RectangleRoiTool?

See original GitHub issue


  • Are you running the latest version?
  • Are you reporting to the correct repository?
  • Did you perform a cursory search?

For more information, see the CONTRIBUTING guide.


I am working currently on a tool that has to calculate a volume, this means, I draw an area using the RectangleRoiTool, and then I have to replicate that area on X number of images. I am doing this by using addToolState on each image, using the toolState from the area I created. The problem is, when the script scrolls to the next image and adds the tool state, it doesn’t recalculate the Mean and StdDev of the current image, but it is saving the data from the created area. Is there an option to recalculate the state once it is added? Specifically for the RectangleRoiTool.


Steps to Reproduce

  1. Draw a rectangle using RectangleRoiTool.
  2. Save the tool state on a variable.
  3. Add the saved tool state on any other image. The calculations are still the ones from the variable, not the ones that should be from this new image.

Expected behavior: Once the tool state is added, it should recalculate the information from this new image.

Actual behavior: After setting the tool state, the information from the saved state is static, no recalculation is being triggered.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:18 (9 by maintainers)

github_iconTop GitHub Comments

pzehlecommented, Mar 18, 2019

Hi @JamesAPetts, I think it is an excellent idea, mainly because right now it is complicated to achieve what I wanted, though it was relatively easy to accomplish, I think this would resolve a lot of issues.

pzehlecommented, Mar 17, 2019

Hi @dannyrb. For now is OK. I will work in the future on a PR to have an automated method to accomplish this without any of these processes. I will let you know. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

API Docs - Cornerstone Tools
Enumerates the events for CornestoneTools. Native events are captured, normalized, and re-triggered with a cornerstonetools prefix. This allows us to handle ...
Read more >
cornerstone-tools - UNPKG
tools /annotation/RectangleRoiTool.js","webpack://cornerstoneTools/. ... *\n * @param {EventTarget} el The element or EventTarget to trigger the event upon.
Read more >
How to use the cornerstone-tools.clearToolState function in ...
element, resizeThrottleMs); } // Only after `uuid` is set for enabledElement this._setupLoadHandlers(); try { // Setup "Stack State" cornerstoneTools.
Read more >
Dynamically adding toolStates (i.e. for restoring annotations)
addToolState (data.element, toolType, td); ... The funny thing is when after adding the saved tool state I call cornerstoneTools.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found