Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
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
33struct _object;
34typedef _object PyObject;
35#endif
36class qSlicerSubjectHierarchyScriptedPluginPrivate;
37
38class vtkObject;
39class QStandardItem;
40class QAction;
42
61class Q_SLICER_MODULE_SUBJECTHIERARCHY_WIDGETS_EXPORT qSlicerSubjectHierarchyScriptedPlugin : public qSlicerSubjectHierarchyAbstractPlugin
62{
63 Q_OBJECT
64
65public:
67 qSlicerSubjectHierarchyScriptedPlugin(QObject* parent = nullptr);
69
70 Q_INVOKABLE QString pythonSource() const;
71
74 Q_INVOKABLE bool setPythonSource(const QString filePath);
75
77 Q_INVOKABLE PyObject* self() const;
78
81 void setName(QString name) override;
82
83 // Role-related virtual methods
84 // If the subclass plugin does not offer a role, these do not need to be overridden
85public:
92 double canOwnSubjectHierarchyItem(vtkIdType itemID) const override;
93
96 const QString roleForPlugin() const override;
97
99 const QString helpText() const override;
100
103 QIcon icon(vtkIdType itemID) override;
104
106 QIcon visibilityIcon(int visible) override;
107
109 void editProperties(vtkIdType itemID) override;
110
113 QString displayedItemName(vtkIdType itemID) const override;
114
116 QString tooltip(vtkIdType itemID) const override;
117
119 void setDisplayVisibility(vtkIdType itemID, int visible) override;
120
123 int getDisplayVisibility(vtkIdType itemID) const override;
124
125 // Function related virtual methods
126public:
129
132
137
140 void showContextMenuActionsForItem(vtkIdType itemID) override;
141
145 void showViewContextMenuActionsForItem(vtkIdType itemID, QVariantMap eventData) override;
146
147 // Parenting related virtual methods with default implementation
148public:
158 double canAddNodeToSubjectHierarchy(vtkMRMLNode* node, vtkIdType parentItemID = vtkMRMLSubjectHierarchyNode::INVALID_ITEM_ID) const override;
159
168 double canReparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID) const override;
169
172 bool reparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID) override;
173
174protected:
175 QScopedPointer<qSlicerSubjectHierarchyScriptedPluginPrivate> d_ptr;
176
177private:
178 Q_DECLARE_PRIVATE(qSlicerSubjectHierarchyScriptedPlugin);
180};
181
182#endif
qSlicerSubjectHierarchyAbstractPlugin(QObject *parent=nullptr)
Q_INVOKABLE bool setPythonSource(const QString filePath)
QString displayedItemName(vtkIdType itemID) const override
int getDisplayVisibility(vtkIdType itemID) const override
QScopedPointer< qSlicerSubjectHierarchyScriptedPluginPrivate > d_ptr
void showViewContextMenuActionsForItem(vtkIdType itemID, QVariantMap eventData) override
Q_INVOKABLE QString pythonSource() const
QIcon icon(vtkIdType itemID) override
void showContextMenuActionsForItem(vtkIdType itemID) override
qSlicerSubjectHierarchyScriptedPlugin(QObject *parent=nullptr)
double canAddNodeToSubjectHierarchy(vtkMRMLNode *node, vtkIdType parentItemID=vtkMRMLSubjectHierarchyNode::INVALID_ITEM_ID) const override
QList< QAction * > viewContextMenuActions() const override
Get view item context menu item actions to add to views.
void editProperties(vtkIdType itemID) override
Open module belonging to item and set inputs in opened module.
Q_INVOKABLE PyObject * self() const
Convenience method allowing to retrieve the associated scripted instance.
double canReparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID) const override
QList< QAction * > sceneContextMenuActions() const override
bool reparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID) override
void setDisplayVisibility(vtkIdType itemID, int visible) override
Set display visibility of a owned subject hierarchy item.
const QString roleForPlugin() const override
void setName(QString name) override
QList< QAction * > itemContextMenuActions() const override
Get item context menu item actions to add to tree view.
QString tooltip(vtkIdType itemID) const override
Generate tooltip for a owned subject hierarchy item.
double canOwnSubjectHierarchyItem(vtkIdType itemID) const override
const QString helpText() const override
Get help text for plugin to be added in subject hierarchy module widget help box.
QIcon visibilityIcon(int visible) override
Get visibility icon for a visibility state.
Abstract Superclass for all specific types of MRML nodes.
QMap< QString, QVariant > QVariantMap
_object PyObject