Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
qSlicerSubjectHierarchyPluginLogic.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 __qSlicerSubjectHierarchyPluginLogic_h
24#define __qSlicerSubjectHierarchyPluginLogic_h
25
26// Slicer includes
27#include "qSlicerObject.h"
28
29// CTK includes
30#include <ctkVTKObject.h>
31
32// Qt includes
33#include <QObject>
34
35// MRML includes
36#include <vtkMRMLScene.h>
38
39#include "qSlicerSubjectHierarchyModuleWidgetsExport.h"
40
41class QAction;
42class QMenu;
43class qSlicerSubjectHierarchyPluginLogicPrivate;
45
48class Q_SLICER_MODULE_SUBJECTHIERARCHY_WIDGETS_EXPORT qSlicerSubjectHierarchyPluginLogic :
49 public QObject, public virtual qSlicerObject
50{
51 Q_OBJECT
52 QVTK_OBJECT
53
59
60public:
61 typedef QObject Superclass;
62 qSlicerSubjectHierarchyPluginLogic(QObject *parent=nullptr);
64
65public:
67 void setMRMLScene(vtkMRMLScene* scene) override;
68
71
73 Q_INVOKABLE vtkIdType currentSubjectHierarchyItem()const;
74
77 Q_INVOKABLE void setCurrentSubjectHierarchyItem(vtkIdType itemID);
78
83
87
93 void setAllowedViewContextMenuActionNames(QStringList actionObjectNames);
94
97
103 Q_INVOKABLE void setAllowedViewContextMenuActionNamesForItem(vtkIdType itemID, const QStringList& actionObjectNames);
104
107 Q_INVOKABLE QStringList allowedViewContextMenuActionNamesForItem(vtkIdType itemID);
108
115 static Q_INVOKABLE QString buildMenuFromActions(QMenu* menu, QList< QAction* > actions, const QStringList& allowedActions=QStringList());
116
117protected:
120
126
128 void registerViewContextMenuAction(QAction* action);
129
130protected slots:
132 void onNodeAdded(vtkObject* scene, vtkObject* nodeObject);
135 void onNodeAboutToBeRemoved(vtkObject* scene, vtkObject* nodeObject);
138 void onNodeRemoved(vtkObject* scene, vtkObject* nodeObject);
142 void onSceneImportEnded(vtkObject* sceneObject);
144 void onSceneCloseEnded(vtkObject* sceneObject);
147 void onSceneRestoreEnded(vtkObject* sceneObject);
150 void onSceneBatchProcessEnded(vtkObject* sceneObject);
151
153 void onDisplayNodeModified(vtkObject*, vtkObject*);
155 void onDisplayMenuEvent(vtkObject*, vtkObject*);
158
159protected:
160 QScopedPointer<qSlicerSubjectHierarchyPluginLogicPrivate> d_ptr;
161
162private:
163 Q_DECLARE_PRIVATE(qSlicerSubjectHierarchyPluginLogic);
166};
167
168#endif
Abstract plugin for handling Subject Hierarchy items.
QScopedPointer< qSlicerSubjectHierarchyPluginLogicPrivate > d_ptr
void observeNode(vtkMRMLNode *node)
Add observations for node that was added to subject hierarchy.
static Q_INVOKABLE QString buildMenuFromActions(QMenu *menu, QList< QAction * > actions, const QStringList &allowedActions=QStringList())
void editProperties()
Called when the user clicks the Edit properties View menu action.
void onNodeAboutToBeRemoved(vtkObject *scene, vtkObject *nodeObject)
Q_INVOKABLE void setAllowedViewContextMenuActionNamesForItem(vtkIdType itemID, const QStringList &actionObjectNames)
void onNodeAdded(vtkObject *scene, vtkObject *nodeObject)
Called when a node is added to the scene so that a plugin can create an item for it.
void onNodeRemoved(vtkObject *scene, vtkObject *nodeObject)
Q_INVOKABLE void setCurrentSubjectHierarchyItem(vtkIdType itemID)
void setMRMLScene(vtkMRMLScene *scene) override
Set the current MRML scene to the logic.
void registerViewContextMenuAction(QAction *action)
Add view menu action. Called by plugin handler when registering a plugin.
void onSceneRestoreEnded(vtkObject *sceneObject)
void setAllowedViewContextMenuActionNames(QStringList actionObjectNames)
Q_INVOKABLE vtkIdType currentSubjectHierarchyItem() const
Assessor function for getting currently selected subject hierarchy item (for python)
void onSceneBatchProcessEnded(vtkObject *sceneObject)
QStringList registeredViewContextMenuActionNames
List of all registered view context menu actions.
qSlicerSubjectHierarchyPluginLogic(QObject *parent=nullptr)
Q_INVOKABLE QStringList allowedViewContextMenuActionNamesForItem(vtkIdType itemID)
void onSceneImportEnded(vtkObject *sceneObject)
void onDisplayNodeModified(vtkObject *, vtkObject *)
Called when display node modified event is invoked on an owned displayable node.
void onSceneCloseEnded(vtkObject *sceneObject)
Called when scene import is finished. Hierarchy is cleared in that case.
Q_INVOKABLE qSlicerSubjectHierarchyAbstractPlugin * subjectHierarchyPluginByName(QString name) const
Assessor function for getting subject hierarchy plugin by name (for python)
void onDisplayMenuEvent(vtkObject *, vtkObject *)
Called when menu event is invoked on a display node of an owned displayable node.
Abstract Superclass for all specific types of MRML nodes.
A set of MRML Nodes that supports serialization and undo/redo.