Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hierarchy visibility refactoring #1214

Closed

Conversation

cpinter
Copy link
Member

@cpinter cpinter commented Sep 17, 2019

The are two main goals of this PR:

  • Change the way visibility works in subject hierarchy for folders
  • Remove model hierarchies from Slicer

This is the related issue: PerkLab/SlicerOpenAnatomy#4

Details:

  1. Use only folders in subject hierarchy instead of the former hybrid folder / model hierarchy way (which had some issues, such as the inability to create folders that allow overriding display properties, only programmatically or opening a scene).
    • Convert model hierarchies to SH folders on scene import
    • Change SH node visibility functions to only change visibility in the directly or indirectly associated display node, instead of applying the visibility setting on all children individually
    • Folder items have a directly associated display node after any interaction with display settings of the folder. A new display node type vtkMRMLFolderDisplayNode is added for this
    • DICOM type hierarchy items (subject, study) now subclass folders, inheriting all its features
    • Displayable managers now consider only folders, not model hierarchies. If a folder has apply display properties on branch enabled, then the model uses the display node of the folder for all properties
      • Visibility of the parent items is always considered (i.e. if a parent is hidden, the branch is hidden, regardless the override settings)
      • Opacity of the parent items is always considered (i.e. multiply the opacity values of the branch)
      • Displayable managers that now support overrides: Model 3D+2D, Segmentations 3D+2D, Markups (for markups it's not the DM but the VTKWidget that applies the display properties)
    • Add new event SubjectHierarchyItemReparentedEvent to SH. It is used to update display if models after reparenting (may be dropped under a folder that overrides display properties)
    • Display nodes have a FolderDisplayOverrideAllowed flag, which determines whether folder nodes can override their display properties. On by default
    • Handle multi-select in models SH (change opacity, set slice intersection etc for multiple models)
  2. Remove model hierarchy
    • Remove ModelHierarchy mode from qMRMLTreeView
    • Remove ModelHierarchyDisplayNodeClassName concept from selection node
    • Update segmentation import/export from/to model hierarchies to use folders instead where appropriate
      • Use subject hierarchy combobox instead of MRML node combobox in Import/export section in Segmentations module
      • Add option to filter for multiple levels in subject hierarchy
    • Update qMRMLModelDisplayNodeWidget to support folders
      • Set SH item instead of "ModelOrHierarchyNode"
      • Use generic display node and only show model display node features if item of model node is set
    • Remove fiber related features from Models module UI (@pieper will later re-add SH features for this with my help)

Questions:

  • ScenePerformance.py - What are the model hierarchy tests measuring? Should I add folder display nodes instead?

Post-PR tasks (while we discuss the PR and while I fix any occasional things to fix):

  • "Convert model hierarchy to segmentation node" also available from Folders SH plugin
  • Cache overriding folder node reference in display nodes (if getting overriding folder turns out to be a bottleneck)

@cpinter
Copy link
Member Author

cpinter commented Sep 18, 2019

If there are no comments, I will integrate this tonight.

@jcfr Can you please answer the question I had with one of the tests? It seems you added this test. Thanks!

ScenePerformance.py - What are the model hierarchy tests measuring? Should I add folder display nodes instead?

Subject hierarchy (SH) is now used in the Models module to make it more stable and have more features. A mechanism has been in place to keep supporting model hierarchies alongside the SH folders. This commit removes this support, and changes the way visibility is handled by subject hierarchy, and the way display properties are overridden for branches.
- Convert model hierarchies to SH folders on scene import
- Change SH node visibility functions to only change visibility in the directly or indirectly associated display node, instead of applying the visibility setting on all children individually
- Folder items have a directly associated display node after any interaction with display settings of the folder. A new display node type vtkMRMLFolderDisplayNode is added for this
- DICOM type hierarchy items (subject, study) now subclass folders, inheriting all its features
- Model displayable manager now considers only folders, not model hierarchies. If a folder has apply display properties on branch enabled, then the model uses the display node of the folder for all properties
  - Visibility of the parent items is always considered (i.e. if a parent is hidden, the branch is hidden, regardless the override settings)
  - Opacity of the parent items is always considered (i.e. multiply the opacity values of the branch)
- Add new event SubjectHierarchyItemReparentedEvent to SH. It is used to update display if models after reparenting (may be dropped under a folder that overrides display properties)
- Remove ModelHierarchy mode from qMRMLTreeView
- Remove ModelHierarchyDisplayNodeClassName concept from selection node
- Update segmentation import/export from/to model hierarchies to use folders instead where appropriate
  - Use subject hierarchy combobox instead of MRML node combobox in Import/export section in Segmentations module
  - Add option to filter for multiple levels in subject hierarchy
- Update qMRMLModelDisplayNodeWidget to support folders
  - Set SH item instead of "ModelOrHierarchyNode"
  - Use generic display node and only show model display node features if item of model node is set
- Displayable managers that now support overrides: Model 3D+2D, Segmentations 3D+2D
- Display nodes have a FolderDisplayOverrideAllowed flag, which determines whether folder nodes can override their display properties. On by default
- Instead of the displayable managers handling the folder and subject hierarchy events, this is now managed centrally by the folder display node
The Include Fibers checkbox and the fiber display types tab widget did not work since the switch to using SH tree in the Models module.
These features will be re-added as SH plugins.
- Automated python test added for the subject hierarchy folder features: show/hide, color override, hierarchy visibility and opacity, FolderDisplayOverrideAllowed display node flag
- Fix vtkSlicerSubjectHierarchyModuleLogicTest automated test
- Utility functions added to subject hierarchy node for getting items by name
- Folder visibility and opacity is considered for markups
- Add support for folder color override for markups
The widget shows the properties of the first selected model, but if a property is changed, then that one property it is applied to all selected.
@cpinter cpinter force-pushed the hierarchy-visibility-refactoring branch from d330635 to 4dfb85d Compare September 19, 2019 14:47
@cpinter cpinter closed this Sep 19, 2019
@cpinter
Copy link
Member Author

cpinter commented Sep 19, 2019

If there is any issue, I'll be happy to fix it.

@jcfr please answer the (btw minor) question about ScenePerformance.py, just so that it's not forgotten.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant