Skip to content

ENH: Made view axis labels configurable

Andras Lasso requested to merge github/fork/lassoan/custom-axis-labels into master

For some applications standard left/right, posterior/anterior, inferior/superior axis labels are not optimal. For example for eye image analysis temporal/nasal labels are more appropriate than left/right. Labels may have to be view-specific, e.g., show standard labels on a large overview image and show custom labels in a view that shows a small segmented structure.

Implemented solution:

  • vtkMRMLAbstractViewNode stores axis labels (SetAxisLabel/GetAxisLabel methods can be used to set/get the labels)
  • vtkMRMLViewDisplayableManager and vtkMRMLOrientationMarkerDisplayableManager read labels from vtkMRMLAbstractViewNode instead of using hard-coded strings to show in Cube and Axes orientation markers and 3D cube labels
  • DataProbe read labels from vtkMRMLAbstractViewNode instead of using hard-coded string

No user interface is implemented, as this is an advanced feature for module developers. Example use:

sliceNode = slicer.mrmlScene.GetNodeByID('vtkMRMLSliceNodeRed')
sliceNode.SetOrientationMarkerType(slicer.vtkMRMLAbstractViewNode.OrientationMarkerTypeAxes)
sliceNode.SetOrientationMarkerSize(slicer.vtkMRMLAbstractViewNode.OrientationMarkerSizeLarge)
sliceNode.SetAxisLabel(0,'Proximal')
sliceNode.SetAxisLabel(1,'Distal')

viewNode = slicer.mrmlScene.GetNodeByID('vtkMRMLViewNode1')
viewNode.SetOrientationMarkerType(slicer.vtkMRMLAbstractViewNode.OrientationMarkerTypeAxes)
viewNode.SetOrientationMarkerSize(slicer.vtkMRMLAbstractViewNode.OrientationMarkerSizeLarge)
viewNode.SetAxisLabel(0,'Proximal')
viewNode.SetAxisLabel(1,'Distal')

Merge request reports

Loading