Slicer  5.0
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qSlicerSubjectHierarchyFolderPlugin.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Copyright (c) Laboratory for Percutaneous Surgery (PerkLab)
6  Queen's University, Kingston, ON, Canada. All Rights Reserved.
7 
8  See COPYRIGHT.txt
9  or http://www.slicer.org/copyright/copyright.txt for details.
10 
11  Unless required by applicable law or agreed to in writing, software
12  distributed under the License is distributed on an "AS IS" BASIS,
13  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  See the License for the specific language governing permissions and
15  limitations under the License.
16 
17  This file was originally developed by Csaba Pinter, PerkLab, Queen's University
18  and was supported through the Applied Cancer Research Unit program of Cancer Care
19  Ontario with funds provided by the Ontario Ministry of Health and Long-Term Care
20 
21 ==============================================================================*/
22 
23 #ifndef __qSlicerSubjectHierarchyFolderPlugin_h
24 #define __qSlicerSubjectHierarchyFolderPlugin_h
25 
26 // SubjectHierarchy Plugins includes
28 
29 #include "qSlicerSubjectHierarchyModuleWidgetsExport.h"
30 
31 // CTK includes
32 #include <ctkVTKObject.h>
33 
34 class qSlicerSubjectHierarchyFolderPluginPrivate;
35 
36 class vtkMRMLDisplayNode;
37 
53 class Q_SLICER_MODULE_SUBJECTHIERARCHY_WIDGETS_EXPORT qSlicerSubjectHierarchyFolderPlugin : public qSlicerSubjectHierarchyAbstractPlugin
54 {
55 public:
56  Q_OBJECT
57  QVTK_OBJECT
58 
59 public:
61  qSlicerSubjectHierarchyFolderPlugin(QObject* parent = nullptr);
63 
64 public:
73  vtkMRMLNode* node,
74  vtkIdType parentItemID=vtkMRMLSubjectHierarchyNode::INVALID_ITEM_ID )const override;
75 
77  bool addNodeToSubjectHierarchy(vtkMRMLNode* node, vtkIdType parentItemID) override;
78 
85  double canOwnSubjectHierarchyItem(vtkIdType itemID)const override;
86 
89  Q_INVOKABLE const QString roleForPlugin()const override;
90 
93  QIcon icon(vtkIdType itemID) override;
94 
96  QIcon visibilityIcon(int visible) override;
97 
99  void editProperties(vtkIdType itemID) override;
100 
102  void setDisplayVisibility(vtkIdType itemID, int visible) override;
103 
106  int getDisplayVisibility(vtkIdType itemID)const override;
107 
113  void setDisplayColor(vtkIdType itemID, QColor color, QMap<int, QVariant> terminologyMetaData) override;
114 
118  QColor getDisplayColor(vtkIdType itemID, QMap<int, QVariant> &terminologyMetaData)const override;
119 
121  QList<QAction*> itemContextMenuActions()const override;
122 
127 
130  void showContextMenuActionsForItem(vtkIdType itemID) override;
131 
135 
138  void showVisibilityContextMenuActionsForItem(vtkIdType itemID) override;
139 
140 public:
143  Q_INVOKABLE vtkIdType createFolderUnderItem(vtkIdType parentItemID);
144 
146  Q_INVOKABLE QString colorItemAttributeName()const { return "Color"; };
147 
150  vtkMRMLDisplayNode* createDisplayNodeForItem(vtkIdType itemID);
151 
152 protected slots:
154  void createFolderUnderScene();
155 
157  void createFolderUnderCurrentNode();
158 
160  void onApplyColorToBranchToggled(bool);
161 
162 protected:
166  vtkMRMLDisplayNode* displayNodeForItem(vtkIdType itemID)const;
167 
169  bool isApplyColorToBranchEnabledForItem(vtkIdType itemID)const;
171  void setApplyColorToBranchEnabledForItem(vtkIdType itemID, bool enabled);
172 
173 protected:
174  QScopedPointer<qSlicerSubjectHierarchyFolderPluginPrivate> d_ptr;
175 
176 private:
177  Q_DECLARE_PRIVATE(qSlicerSubjectHierarchyFolderPlugin);
178  Q_DISABLE_COPY(qSlicerSubjectHierarchyFolderPlugin);
179 };
180 
181 #endif
virtual Q_INVOKABLE void setDisplayVisibility(vtkIdType itemID, int visible)
Set display visibility of an owned subject hierarchy item.
QScopedPointer< qSlicerSubjectHierarchyFolderPluginPrivate > d_ptr
virtual QIcon icon(vtkIdType itemID)
virtual Q_INVOKABLE const QString roleForPlugin() const
virtual double canAddNodeToSubjectHierarchy(vtkMRMLNode *node, vtkIdType parentItemID=vtkMRMLSubjectHierarchyNode::INVALID_ITEM_ID) const
qSlicerSubjectHierarchyAbstractPlugin Superclass
Abstract plugin for handling Subject Hierarchy items.
virtual Q_INVOKABLE void editProperties(vtkIdType itemID)
Open module belonging to item and set inputs in opened module.
Q_INVOKABLE QString colorItemAttributeName() const
Name of color attribute in folder subject hierarchy items.
virtual Q_INVOKABLE QColor getDisplayColor(vtkIdType itemID, QMap< int, QVariant > &terminologyMetaData) const
virtual Q_INVOKABLE int getDisplayVisibility(vtkIdType itemID) const
virtual bool addNodeToSubjectHierarchy(vtkMRMLNode *node, vtkIdType parentItemID)
virtual Q_INVOKABLE void setDisplayColor(vtkIdType itemID, QColor color, QMap< int, QVariant > terminologyMetaData)
virtual Q_INVOKABLE void showContextMenuActionsForItem(vtkIdType itemID)
virtual Q_INVOKABLE QList< QAction * > sceneContextMenuActions() const
virtual Q_INVOKABLE QIcon visibilityIcon(int visible)
Get visibility icon for a visibility state.
virtual Q_INVOKABLE QList< QAction * > visibilityContextMenuActions() const
Abstract class that contains graphical display properties for displayable nodes.
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
virtual Q_INVOKABLE void showVisibilityContextMenuActionsForItem(vtkIdType itemID)
virtual Q_INVOKABLE double canOwnSubjectHierarchyItem(vtkIdType itemID) const
virtual Q_INVOKABLE QList< QAction * > itemContextMenuActions() const