ENH: Reworked markups fiducials and added line, angle, and curves

Closed Andras Lasso requested to merge github/fork/lassoan/widget-rework3 into master


  • New markups: angle, line, open curve, closed curve
  • Speed improvement: thousands of markup points can be visualized and interactively manipulated (previously, the limit was about 50-100 points)
  • Live preview: preview of markup position and label is shown during placement in all views, current point is highlighted in all views
  • Slide on surface: in 3D views, markups are kept on visible surfaces (previously, placement was done on visible surface, but adjustments were simply constrained to the view plane)
  • Improved keyboard shortcuts:
    • LeftClick to jump to control point
    • LeftClick-and-drag: translate control point
    • Delete: delete highlighted markup
    • Ctrl-LeftClick: insert point along line
    • MiddleClick-and-drag: translate widget (experimental)


  • Labels in 3D can no longer be partially obscured by 3D geometry (sometimes labels are visible when the corresponding markup is not visible anymore, but this will be fixed soon)
  • Point picking in 3D views is unstable

Infrastructure improvements:

  • Focus management is centralized (interactor style queries all the displayable managers if they can process the event and then forwards the event for processing to the most suitable one). This allows much faster event management than using VTK's picking manager.
  • Interaction events are converted to vtkEventData type (originally introduced for virtual reality), which can carry all important metadata with them (display and world position, key modifiers, associated view and data nodes, etc.). This allows processing all kinds of interaction events (mouse, keyboard, virtual reality, any new interaction devices, etc.) using the same framework and modules have easy access to lots of metadata in all interaction events.
  • Maximum number of markups can be specified for markups fiducials (e.g., if it is set to 1 then the markup node can be used for getting a single point from the user).
  • Any point can be placed again (no user interface for this yet) - this can be used for predefining markup names and then place them.
  • Keyboard shortcuts are configurable (no user interface yet) - flexible module/application specific keyboard mapping is feasible (VTK's event translator does not support event translation with modifiers, widget-state-dependent shortcuts, etc.)
  • No more synchronization needed between MRML and widget states: widget states are directly stored in MRML, including point positions (as vtkPolyData) - in local and world coordinate system. This removed lots of synchronization overhead and potential for bugs.

Note that this first set of changes is just a beginning of a number of new features and improvements.

See list of known bugs and limitations in this spreadsheet: https://1drv.ms/x/s!Arm_AFxB9yqHtvxAgdAfdLS_GHsOxw

Merge request reports