Slicer  4.10
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 // MRML includes
35 #include <vtkMRMLHierarchyNode.h>
36 
37 class qSlicerSubjectHierarchyFolderPluginPrivate;
38 
40 
41 // Due to some reason the Python wrapping of this class fails, therefore
42 // put everything between BTX/ETX to exclude from wrapping.
43 // TODO investigate why the wrapping fails:
44 // https://www.assembla.com/spaces/slicerrt/tickets/210-python-wrapping-error-when-starting-up-slicer-with-slicerrt
45 //BTX
46 
90 class Q_SLICER_MODULE_SUBJECTHIERARCHY_WIDGETS_EXPORT qSlicerSubjectHierarchyFolderPlugin : public qSlicerSubjectHierarchyAbstractPlugin
91 {
92 public:
93  Q_OBJECT
94  QVTK_OBJECT
95 
96 public:
98  qSlicerSubjectHierarchyFolderPlugin(QObject* parent = NULL);
100 
101 public:
108  virtual double canOwnSubjectHierarchyItem(vtkIdType itemID)const;
109 
112  Q_INVOKABLE virtual const QString roleForPlugin()const;
113 
116  virtual QIcon icon(vtkIdType itemID);
117 
119  virtual QIcon visibilityIcon(int visible);
120 
122  virtual void editProperties(vtkIdType itemID);
123 
129  virtual void setDisplayColor(vtkIdType itemID, QColor color, QMap<int, QVariant> terminologyMetaData);
130 
134  virtual QColor getDisplayColor(vtkIdType itemID, QMap<int, QVariant> &terminologyMetaData)const;
135 
138 
143 
146  virtual void showContextMenuActionsForItem(vtkIdType itemID);
147 
151 
154  virtual void showVisibilityContextMenuActionsForItem(vtkIdType itemID);
155 
156 public:
164  virtual double canAddNodeToSubjectHierarchy(
165  vtkMRMLNode* node,
166  vtkIdType parentItemID=vtkMRMLSubjectHierarchyNode::INVALID_ITEM_ID )const;
167 
173  virtual bool addNodeToSubjectHierarchy(vtkMRMLNode* node, vtkIdType parentItemID);
174 
183  virtual double canReparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID)const;
184 
187  virtual bool reparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID);
188 
189 public:
192  Q_INVOKABLE vtkIdType createFolderUnderItem(vtkIdType parentItemID);
193 
198  Q_INVOKABLE vtkMRMLHierarchyNode* hierarchyNodeForItem(vtkIdType itemID);
199 
204  Q_INVOKABLE vtkIdType itemForHierarchyNode(vtkMRMLHierarchyNode* hierarchyNode);
205 
208  Q_INVOKABLE bool resolveHierarchyForItem(vtkIdType itemID);
209 
212  Q_INVOKABLE bool resolveHierarchies();
213 
215  Q_INVOKABLE QString colorItemAttributeName()const { return "Color"; };
216 
217 public slots:
222  void onDataNodeAssociatedToHierarchyNode(vtkObject* dataNodeObject);
223 
224 protected slots:
226  void createFolderUnderScene();
227 
229  void createFolderUnderCurrentNode();
230 
233  void onHierarchyNodeChildNodeAdded(vtkObject* parentNodeObject, vtkObject* childNodeObject);
234 
236  void onApplyColorToBranchToggled(bool);
237 
238 protected:
242  vtkMRMLModelDisplayNode* modelDisplayNodeForItem(vtkIdType itemID)const;
243 
244  void callModifiedOnModelNodesInCurrentBranch();
245 
246 protected:
247  QScopedPointer<qSlicerSubjectHierarchyFolderPluginPrivate> d_ptr;
248 
249 private:
250  Q_DECLARE_PRIVATE(qSlicerSubjectHierarchyFolderPlugin);
251  Q_DISABLE_COPY(qSlicerSubjectHierarchyFolderPlugin);
252 };
253 
254 //ETX
255 
256 #endif
QScopedPointer< qSlicerSubjectHierarchyFolderPluginPrivate > d_ptr
virtual QIcon icon(vtkIdType itemID)
virtual Q_INVOKABLE const QString roleForPlugin() const
MRML node to represent a display property of 3D surface model.
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.
Abstract class representing a hierarchy member.
virtual double canReparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID) const
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 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 Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:138
virtual Q_INVOKABLE void showVisibilityContextMenuActionsForItem(vtkIdType itemID)
virtual Q_INVOKABLE double canOwnSubjectHierarchyItem(vtkIdType itemID) const
virtual bool reparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID)
virtual Q_INVOKABLE QList< QAction * > itemContextMenuActions() const