Skip to content

Commit

Permalink
ENH: Allow disabling histogram (2D views) interactions of ThresholdEf…
Browse files Browse the repository at this point in the history
…fect

This is useful in custom workflows where threshold preview is needed but interactive adjustment of threshold range must be prevented.

It is not added as a effect parameter because then the setting would have been always saved in the scene and exposed on the GUI, adding complexity to the scene and the GUI - for supporting a very rare use case.
  • Loading branch information
mauigna06 authored and lassoan committed Apr 15, 2024
1 parent fbb7f95 commit 98e542e
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ def __init__(self, scriptedEffect):
self.selectionStartPosition = None
self.selectionEndPosition = None

# Threshold range can be set by clicking in slice views. When the effect (or derived effects, such
# as Local Threshold) is used programmatically in a custom module then it may be desirable to show
# the threshold preview glow, but not let the user modify the preset threshold by view interactions.
# In such cases, enableViewInteractions can be set to False.
self.enableViewInteractions = True

def clone(self):
import qSlicerSegmentationsEditorEffectsPythonQt as effects

Expand Down Expand Up @@ -738,6 +744,9 @@ def processInteractionEvents(self, callerInteractor, eventId, viewWidget):
# The behavior could be made more deterministic by storing a preferred segment editor node in the selection node
# and not using the same segment editor node in multiple segment editor widgets.

if not self.enableViewInteractions:
return abortEvent

masterImageData = self.scriptedEffect.sourceVolumeImageData()
if masterImageData is None:
return abortEvent
Expand Down

0 comments on commit 98e542e

Please sign in to comment.