Slicer  4.11
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
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 
41 class QAction;
42 class qSlicerSubjectHierarchyPluginLogicPrivate;
44 
48 class Q_SLICER_MODULE_SUBJECTHIERARCHY_WIDGETS_EXPORT qSlicerSubjectHierarchyPluginLogic :
49  public QObject, public virtual qSlicerObject
50 {
51  Q_OBJECT
52  QVTK_OBJECT
53 
54 public:
55  typedef QObject Superclass;
56  qSlicerSubjectHierarchyPluginLogic(QObject *parent=nullptr);
58 
59 public:
61  void setMRMLScene(vtkMRMLScene* scene) override;
62 
64  Q_INVOKABLE qSlicerSubjectHierarchyAbstractPlugin* subjectHierarchyPluginByName(QString name)const;
65 
67  Q_INVOKABLE vtkIdType currentSubjectHierarchyItem()const;
68 
71  Q_INVOKABLE void setCurrentSubjectHierarchyItem(vtkIdType itemID);
72 
76  void registerCorePlugins();
77 
80  Q_INVOKABLE QStringList availableViewMenuActionNames();
84  Q_INVOKABLE void setDisplayedViewMenuActionNames(QStringList actionObjectNames);
85 
86 protected:
88  void observeNode(vtkMRMLNode* node);
89 
94  void addSupportedDataNodesToSubjectHierarchy();
95 
97  void registerViewMenuAction(QAction* action);
98 
99 protected slots:
101  void onNodeAdded(vtkObject* scene, vtkObject* nodeObject);
104  void onNodeAboutToBeRemoved(vtkObject* scene, vtkObject* nodeObject);
107  void onNodeRemoved(vtkObject* scene, vtkObject* nodeObject);
111  void onSceneImportEnded(vtkObject* sceneObject);
113  void onSceneCloseEnded(vtkObject* sceneObject);
116  void onSceneRestoreEnded(vtkObject* sceneObject);
119  void onSceneBatchProcessEnded(vtkObject* sceneObject);
120 
122  void onDisplayNodeModified(vtkObject*, vtkObject*);
124  void onDisplayMenuEvent(vtkObject*, vtkObject*);
126  void editProperties();
127 
128 protected:
129  QScopedPointer<qSlicerSubjectHierarchyPluginLogicPrivate> d_ptr;
130 
131 private:
132  Q_DECLARE_PRIVATE(qSlicerSubjectHierarchyPluginLogic);
133  Q_DISABLE_COPY(qSlicerSubjectHierarchyPluginLogic);
135 };
136 
137 #endif
Abstract plugin for handling Subject Hierarchy items.
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:61
Qt-based logic class to exercise Qt-related logic functions. The Subject hierarchy plugin mechanism a...
QScopedPointer< qSlicerSubjectHierarchyPluginLogicPrivate > d_ptr
virtual void setMRMLScene(vtkMRMLScene *)
Set the current MRML scene to the widget.
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
Singleton class managing Subject Hierarchy plugins.