cornerstoneTools icon indicating copy to clipboard operation
cornerstoneTools copied to clipboard

Is there a way to hide text box for roi tools

Open iamZDspark opened this issue 6 years ago • 3 comments

Prerequisites

  • [x] Which version are you using? (Is it latest?)
  • [x] Are you reporting to the correct repository?
  • [x] Did you search existing issues? (Were any related?)

Description

I do not want to show the text box of elliptical roi tool and is there a way to achieve same?

Can we add one configuration for all the toolbox as visible and a condition in renderdata to check for that configuration and then based on that condition call createTextBoxContent() ?

iamZDspark avatar Nov 18 '19 08:11 iamZDspark

There is no option currently:

https://github.com/cornerstonejs/cornerstoneTools/blob/master/src/tools/annotation/EllipticalRoiTool.js#L258-L269

I'm hesitant to add a one-off option. As you've mentioned, there should be a way to do this consistently and/or for all annotation text.

Long-term, we would likely want to move rendering from tools to a "renderer" that handles all tool rendering based on current tool state. That would make it easier to change rendering behavior in a central location, either via schema changes, or by passing in a single flag to the renderer.

dannyrb avatar Nov 18 '19 16:11 dannyrb

Can you guide me on how to achieve it using other ways?

iamZDspark avatar Nov 19 '19 04:11 iamZDspark

@dannyrb I had a requirement to hide the text box for the freehandRoi tool. I had achieved it by changing this in below code. But, I want to raise a PR to make it generic for all the tools. Is my approach correct or can you suggest a better way to do it?

Basically, I added the hideTextBox key in configuration props and added this condition on line 490 of src/tools/FreehandRoiTool.js

  if (config && !config.hideTextBox) {
     drawLinkedTextBox(
       context,
              element,
              data.handles.textBox,
              text,
              data.handles.points,
              textBoxAnchorPoints,
              color,
              lineWidth,
              0,
              true
            );
          }

And from the host App, I am calling this function to hide the text box for freehandRoi

    const FreehandRoiTool = cornerstoneTools.FreehandRoiTool   
    cornerstoneTools.addTool(FreehandRoiTool, {configuration: {
        hideTextBox: true,
      },
    })

kunjesh1 avatar Sep 15 '21 15:09 kunjesh1