cornerstonejs / cornerstoneTools

A framework for tools built on top of Cornerstone.
https://tools.cornerstonejs.org/
MIT License
577 stars 452 forks source link

How to Get The Tool Data on "onClick" on that annotaion #1509

Open Jaganvk29 opened 2 years ago

Jaganvk29 commented 2 years ago

Prerequisites

Description

I am trying to add Label on the annotation like OHIF Measurement Table , so i wanted to get the data on Selected Annotations and set the active annotation programmatically If this feature is possible ? OHIF_annotaion_label

luchen666 commented 1 year ago

I also have this question. Can someone answer it?

Jaganvk29 commented 1 year ago

I also have this question. Can someone answer it? I got This Example in the cornerstone3d site, i think it's not possible in legacy (cornerstone-tools) example -> https://www.cornerstonejs.org/live-examples/annotationselectionandlocking examples list -> https://www.cornerstonejs.org/docs/examples

Theadmaster commented 1 year ago

Annotations have no "selected" event that can be triggered. My way is :

  1. Add a listener to watch the MOUSE_CLICK event.
  2. Get the canvas coordinates and use pointNearTool to check if your point is near the annotation(return true or false).https://github.com/cornerstonejs/cornerstoneTools/blob/73cd5224782cc757275b495178c7889ba95eb152/src/tools/annotation/LengthTool.js note: you can use toolStateManager to match the annotations you added and the measurement data can also be found viatoolStateManager.