ENH: Refactored view ruler and orientation marker
Ruler and orientation marker: available in both 2D and 3D viewers, easier to discover (available in viewer controller widgets and application settings), more customizable (size, visibility, custom ruler scales, orientation marker models), implemented with cleaner design (using displayable managers for rendering and regular node attributes for data storage).
New features:
- Ruler and orientation marker is configurable per viewer in the slice/3D view controller widgets (same way as all view options)
- Ruler and orientation marker can be shown in 3D view
- Default ruler orientation marker settings (and additional 3D view settings, such as orthographic projection, show 3D cube, axis labels, depth peeling) can be configured in the application settings (saved in .ini file)
- Allow using any model in the scene as orientation marker (for example, set a custom orientation marker in the 3D viewer: getNode('View1').SetOrientationMarkerHumanModelNodeID(getNode('ToriaClipped03').GetID() )
- All ruler and orientation marker settings (including custom orientation marker) are saved in the scene
- Added "thick" ruler mode: there is an option now to show the ruler with a thicker line and larger font so that it can be seen from a larger distance (e.g., interventional use)
Fixes bugs in the old implementation:
- ruler showed incorrect value when zoomed in or zoomed out very much (instead of hiding the ruler, it was kept displayed at an incorrect scale)
- Ruler was unusable in lightboxview: ruler line was clipped in half, label was not visible
- Some observers were not removed
Design changes compared to the old implementation:
- Ruler and orientation marker are rendered by displayable managers. This allows much simpler and more robust resource management and rendering update (there was previously an infinite loop in the orientation marker update causing Slicer crash by stack overflow).
- Orientation marker is loaded from a single file, color is stored in scalars. This makes the implementation simpler and displaying of multi-color custom models feasible.
Slicer core changes:
- Allow modifying default node content: Scene can store "default" nodes. If a default node is specified for a class then the content of that node will be used to initialize new nodes and reset nodes. Currently used only for slice and 3D views but can be used for other purposes, too (e.g., disable interpolation by default for volume nodes).
- Removed roll/pitch/yaw buttons from 3D view: to reduce the additional complexity caused by adding 2 new buttons (for show/hide ruler and orientation marker)
- Added common helper functions from accessing file resources from MRML nodes. Previously a Slicer-specific environment variable was hardcoded in vtkMRMLFreeSurferProceduralColorNode. Now the environment variable name is configurable in CMake and GetApplicationHomeDirectory and GetApplicationShareDirectory methods in vtkMRMLLogic can be used to determine resource file paths.
Slice view corner annotations and scalar bar were left unchanged in the DataProbe module, as they were not obvious how to clean up and generalize. Slice corner annotations have to be made more generic, allowing displaying of custom text provided by various modules (see for example CornerAnnotations module). Scalar bar will need to be harmonized with the Color module's scalar bar display (that is currently only available in the 3D view).