Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qSlicerSubjectHierarchyScriptedPlugin.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 __qSlicerSubjectHierarchyScriptedPlugin_h
24 #define __qSlicerSubjectHierarchyScriptedPlugin_h
25 
26 // SubjectHierarchy includes
28 
29 #include "qSlicerSubjectHierarchyModuleWidgetsExport.h"
30 
31 // Forward Declare PyObject*
32 #ifndef PyObject_HEAD
33 struct _object;
34 typedef _object PyObject;
35 #endif
36 class qSlicerSubjectHierarchyScriptedPluginPrivate;
37 
38 class vtkObject;
39 class QStandardItem;
40 class QAction;
42 
61 class Q_SLICER_MODULE_SUBJECTHIERARCHY_WIDGETS_EXPORT qSlicerSubjectHierarchyScriptedPlugin
63 {
64  Q_OBJECT
65 
66 public:
68  qSlicerSubjectHierarchyScriptedPlugin(QObject* parent = NULL);
70 
71  Q_INVOKABLE QString pythonSource()const;
72 
75  Q_INVOKABLE bool setPythonSource(const QString newPythonSource);
76 
78  Q_INVOKABLE PyObject* self() const;
79 
82  virtual void setName(QString name);
83 
84 // Role-related virtual methods
85 // If the subclass plugin does not offer a role, these do not need to be overridden
86 public:
93  virtual double canOwnSubjectHierarchyItem(vtkIdType itemID)const;
94 
97  virtual const QString roleForPlugin()const;
98 
100  virtual const QString helpText()const;
101 
104  virtual QIcon icon(vtkIdType itemID);
105 
107  virtual QIcon visibilityIcon(int visible);
108 
110  virtual void editProperties(vtkIdType itemID);
111 
114  virtual QString displayedItemName(vtkIdType itemID)const;
115 
117  virtual QString tooltip(vtkIdType itemID)const;
118 
120  virtual void setDisplayVisibility(vtkIdType itemID, int visible);
121 
124  virtual int getDisplayVisibility(vtkIdType itemID)const;
125 
126 // Function related virtual methods
127 public:
130 
135 
138  virtual void showContextMenuActionsForItem(vtkIdType itemID);
139 
140 // Parenting related virtual methods with default implementation
141 public:
151  virtual double canAddNodeToSubjectHierarchy(
152  vtkMRMLNode* node,
153  vtkIdType parentItemID=vtkMRMLSubjectHierarchyNode::INVALID_ITEM_ID )const;
154 
163  virtual double canReparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID)const;
164 
167  virtual bool reparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID);
168 
169 protected:
170  QScopedPointer<qSlicerSubjectHierarchyScriptedPluginPrivate> d_ptr;
171 
172 private:
173  Q_DECLARE_PRIVATE(qSlicerSubjectHierarchyScriptedPlugin);
175 };
176 
177 #endif
virtual Q_INVOKABLE void setDisplayVisibility(vtkIdType itemID, int visible)
Set display visibility of a owned subject hierarchy item.
virtual QIcon icon(vtkIdType itemID)
virtual Q_INVOKABLE const QString roleForPlugin() const
virtual double canAddNodeToSubjectHierarchy(vtkMRMLNode *node, vtkIdType parentItemID=vtkMRMLSubjectHierarchyNode::INVALID_ITEM_ID) const
virtual Q_INVOKABLE QString tooltip(vtkIdType itemID) const
Generate tooltip for a owned subject hierarchy item.
QScopedPointer< qSlicerSubjectHierarchyScriptedPluginPrivate > d_ptr
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.
virtual double canReparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID) const
Scripted abstract plugin for handling subject hierarchy items or providing actions for items...
virtual Q_INVOKABLE int getDisplayVisibility(vtkIdType itemID) const
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 void setName(QString name)
virtual const QString helpText() const
Get help text for plugin to be added in subject hierarchy module widget help box. ...
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:135
virtual QString displayedItemName(vtkIdType itemID) const
_object PyObject
virtual Q_INVOKABLE double canOwnSubjectHierarchyItem(vtkIdType itemID) const
virtual bool reparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID)
virtual Q_INVOKABLE QList< QAction * > itemContextMenuActions() const