Disable Histogram Brush in Segment Editor Threshold effect

Hi :wave:

I’m using the segment editor threshold effect in a custom UI to segment a CT. The effect conveniently handles all the nodes that are required for visualization and gives me python access to processing functions. To accomplish this I’ve used the references from the script repository.

I like the sliders and the python interface to setting threshold values and I like how the segment editor handles the display. My problem is that when I set active effect in the temporary qMRMLSegmentEditorWidget it hijacks the interaction mode to the HistogramBrush (circle ROI for threshold values selection by default).

Is there a way to disable the interactive functionality related to clicking the slice views?

You can add an effect parameter (without a GUI widget) to enable/disable local histogram region drawing and send a pull request to integrate this option into Slicer core.

Why is this a problem?

Thanks for the advice. I’ll look into the segment editor source code to see if I can add this parameter.

  • no visual feedback that the interaction mode has changed (it was a surprize to me that there is an interaction mode)
  • inability to use window/level interaction mode while the unconfirmed segmentation is on screen (my use case)

So, when I choose the threshold segmentation I get no feedback that the interaction mode has changed. Other segmentation effects (draw, erase etc) change the mouse pointer.
Since the module panel shows the threshold sliders my assumption was that this is the way the tool works.

Good point. I’ll enable custom view cursor for threshold effect.

Several keyboard&mouse gestures would clash between window/level interaction mode and interactive segmentation, so the two mouse modes are mutually exclusive.

You can see the current interaction mode on the toolbar. If you switch to a segment editor effect then it exits from point placement or window/level adjustment.

I was thinking about this and actually if the cursor change was there I would not have any expectations about the interaction with the effect and thus no problems integrating it into the workflow.
So yeah, the adding a custom cursor is the best solution.

Shall I create an icon for it?

Done. See here.

1 Like

Hi. I would like to disable the histogram cursor and functionality completely on localThreshold effect because it is not needed as the segmentation parameters are selected with GUI. So I can have the previsualization of segmentation without been possible to change it via the mouse.

I tried with this line but it doesn’t work:


Also it would be interesting to me to be able to place a fiducial over the sliceView while the preview of segmentation is on. Changing to fiducial placement mode, disables the previsualization of segmentation

I solved it by creating a copy of LocalThreshold effect and overriding processInteractionEvents to this:

  def processInteractionEvents(self, callerInteractor, eventId, viewWidget):
    return False

Hope it helps someone