View in #cornerstone3d on Slack
@Christopher_Nagy: Hi, thanks for the great library!
I am currently implementing some tools, and was wondering how I can know whether a tool is active or not via the tool/toolGroup API? https://www.cornerstonejs.org/docs/concepts/cornerstone-tools/tools#tool-modes
Tools | Cornerstone.js
@Bill_Wallace: What exactly do you mean by active - there is an “active” tool definition, which means the tool will display and will respond to clicks, but it doesn’t mean the tool is currently being used directly.
For example, zoom tool is active almost always, but clearly you aren’t changing the zoom all the time.
The internal state of a tool when it is currently being directly manipulated is internal to the tool.
@Alireza_Sedghi: https://www.cornerstonejs.org/docs/concepts/cornerstone-tools/tools#tool-modes
@Christopher_Nagy: @Bill_Wallace I am talking about the active state as defined in the tool modes in the above link, so after calling setToolActive
I want to know that the tool is currently listening to keybindings.
@Bill_Wallace: Sorry, too many threads.
Yes, Alireza’s response lists the appropriate docs.
@Christopher_Nagy: Okay, let me reformulate my question: given a concrete toolGroup
and a toolName
such as StackScroll
how can I know that the StackScroll
tool is active in the toolGroup
?
Why: I want to synchronize the tool state with a button state in the UI.
@Alireza_Sedghi: Do you use OHIF or just cornerstone?
@Christopher_Nagy: Cornerstone3D on its own
@Alireza_Sedghi: Then you need to sync it in UI using some sort of event driven approach
you can see OHIF and evaluator
section in the toolbar docs.ohif.org
triggerEvent(eventTarget, Events.TOOL_ACTIVATED, eventDetail);
we publish events
so listen to them and update your UI
@Christopher_Nagy: Okay, thank you!
@Alireza_Sedghi: https://docs.ohif.org/platform/extensions/modules/toolbar/#evaluators
Module: Toolbar | OHIF