Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
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
50 , public virtual qSlicerObject
51{
52 Q_OBJECT
53 QVTK_OBJECT
54
60
61public:
62 typedef QObject Superclass;
63 qSlicerSubjectHierarchyPluginLogic(QObject* parent = nullptr);
65
66public:
68 void setMRMLScene(vtkMRMLScene* scene) override;
69
72
74 Q_INVOKABLE vtkIdType currentSubjectHierarchyItem() const;
75
78 Q_INVOKABLE void setCurrentSubjectHierarchyItem(vtkIdType itemID);
79
84
88
94 void setAllowedViewContextMenuActionNames(QStringList actionObjectNames);
95
98
104 Q_INVOKABLE void setAllowedViewContextMenuActionNamesForItem(vtkIdType itemID, const QStringList& actionObjectNames);
105
108 Q_INVOKABLE QStringList allowedViewContextMenuActionNamesForItem(vtkIdType itemID);
109
116 static Q_INVOKABLE QString buildMenuFromActions(QMenu* menu, QList<QAction*> actions, const QStringList& allowedActions = QStringList());
117
118protected:
121
127
129 void registerViewContextMenuAction(QAction* action);
130
131protected slots:
133 void onNodeAdded(vtkObject* scene, vtkObject* nodeObject);
136 void onNodeAboutToBeRemoved(vtkObject* scene, vtkObject* nodeObject);
139 void onNodeRemoved(vtkObject* scene, vtkObject* nodeObject);
143 void onSceneImportEnded(vtkObject* sceneObject);
145 void onSceneCloseEnded(vtkObject* sceneObject);
148 void onSceneRestoreEnded(vtkObject* sceneObject);
151 void onSceneBatchProcessEnded(vtkObject* sceneObject);
152
154 void onDisplayNodeModified(vtkObject*, vtkObject*);
156 void onDisplayMenuEvent(vtkObject*, vtkObject*);
159
160protected:
161 QScopedPointer<qSlicerSubjectHierarchyPluginLogicPrivate> d_ptr;
162
163private:
164 Q_DECLARE_PRIVATE(qSlicerSubjectHierarchyPluginLogic);
167};
168
169#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.