Import 2017-06-07 23:51:09: master a2b893bc

Author Committer Branch Timestamp Parent
lassoan lassoan master 2016-07-21 12:51:57 master 543e52d7
Changeset

ENH: Allow modules to detect when the user clicks on a markup fiducial

Many times a module need to know when the user selects an existing markup. Often the markup position has to be locked but we still want to be able to detect when the user clicked on it.

Added.improved events:
PointStartInteractionEvent: invoked when mouse button is pressed over a markup point.
PointEndInteractionEvent: invoked when mouse button is released over a markup point. Fixed so that it contains the markup point index.
PointClickedEvent: invoked when mouse button is pressed and released over a markup point, without moving the mouse pointer.

VTK allowed locking a seed but then no interaction is possible. VTK handle and seed widgets were improved (see https://github.com/Slicer/VTK/commit/0f8ed32e0b7018d776271dbf5f27968b716a9e10) to allow locking of position but still able to select.

Slicer markups module behavior was changed so that if a markup point is locked then it can still be selected (but not moved). If the entire markup node is locked then markup points cannot be selected or moved (same behavior as before).

How to test the new/enhanced events:


@vtk.calldata_type(vtk.VTK_INT)
def markupCallback1(caller, eventId, callData):
print("PointStartInteractionEvent: {0}".format(callData))

@vtk.calldata_type(vtk.VTK_INT)
def markupCallback2(caller, eventId, callData):
print("PointEndInteractionEvent: {0}".format(callData))

@vtk.calldata_type(vtk.VTK_INT)
def markupCallback3(caller, eventId, callData):
print("PointClickedEvent: {0}".format(callData))

markupsNode = getNode('F')
observerTag1 = markupsNode.AddObserver(slicer.vtkMRMLMarkupsNode.PointStartInteractionEvent, markupCallback1)
observerTag2 = markupsNode.AddObserver(slicer.vtkMRMLMarkupsNode.PointEndInteractionEvent, markupCallback2)
observerTag3 = markupsNode.AddObserver(slicer.vtkMRMLMarkupsNode.PointClickedEvent, markupCallback3)


Markups module may be improved in the future to use this new event, for example select the markup in the markup list if it is selected in a 2D or 3D view. Also, selection state of markups could be changed when the user clicks on a markup (there could be single-select and multi-select modes).

git-svn-id: http://svn.slicer.org/Slicer4/trunk@25243 3bd1e089-480b-0410-8dfb-8563597acbee

mod - Modules/Loadable/Markups/MRML/vtkMRMLMarkupsNode.h Diff File
mod - Modules/Loadable/Markups/MRMLDM/vtkMRMLMarkupsDisplayableManagerHelper.cxx Diff File
mod - Modules/Loadable/Markups/MRMLDM/vtkMRMLMarkupsFiducialDisplayableManager2D.cxx Diff File
mod - Modules/Loadable/Markups/MRMLDM/vtkMRMLMarkupsFiducialDisplayableManager3D.cxx Diff File