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
qSlicerSubjectHierarchyPluginHandler.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 __qSlicerSubjectHierarchyPluginHandler_h
24#define __qSlicerSubjectHierarchyPluginHandler_h
25
26// SubjectHierarchy includes
27#include "qSlicerSubjectHierarchyModuleWidgetsExport.h"
28
29// MRML includes
30#include <vtkMRMLScene.h>
32
33// VTK includes
34#include <vtkSmartPointer.h>
35#include <vtkWeakPointer.h>
36
37// Qt includes
38#include <QDateTime>
39#include <QList>
40#include <QObject>
41#include <QString>
42
43class vtkMRMLScene;
44class vtkCallbackCommand;
49class qSlicerSubjectHierarchyPluginHandlerCleanup;
50
51
55class Q_SLICER_MODULE_SUBJECTHIERARCHY_WIDGETS_EXPORT qSlicerSubjectHierarchyPluginHandler : public QObject
56{
57 Q_OBJECT
58
80
81public:
84 Q_INVOKABLE static qSlicerSubjectHierarchyPluginHandler* instance();
85
91 Q_INVOKABLE vtkMRMLScene* mrmlScene()const;
92
97
101 Q_INVOKABLE void setCurrentItem(vtkIdType itemID);
102
109 Q_INVOKABLE vtkIdType currentItem()const;
110
114 Q_INVOKABLE void setCurrentItems(QList<vtkIdType> items);
115
119 Q_INVOKABLE QList<vtkIdType> currentItems()const;
120 Q_INVOKABLE void currentItems(vtkIdList* selectedItems)const;
121
127
128 Q_INVOKABLE bool autoDeleteSubjectHierarchyChildren()const;
129 Q_INVOKABLE void setAutoDeleteSubjectHierarchyChildren(bool flag);
138
139public:
143
146
149
152
156
164 vtkMRMLNode* node,
165 vtkIdType parentItemID=vtkMRMLSubjectHierarchyNode::INVALID_ITEM_ID );
166
173 vtkIdType itemID, vtkIdType parentItemID );
174
180
185
189
197
202
204 Q_INVOKABLE void showItemsInView(vtkIdList* itemIDsToShow, vtkMRMLAbstractViewNode* viewNode);
205
208 Q_INVOKABLE QString dumpContextMenuActions();
209
210protected:
212 static void onSubjectHierarchyNodeEvent(vtkObject* caller, unsigned long event, void* clientData, void* callData);
213
214protected:
217
221
225
228
230 vtkWeakPointer<vtkMRMLScene> m_MRMLScene;
231
234
236 vtkSmartPointer<vtkCallbackCommand> m_CallBack;
237
238public:
241
242private:
244 static void cleanup();
245
246private:
247 qSlicerSubjectHierarchyPluginHandler(QObject* parent=nullptr);
248 ~qSlicerSubjectHierarchyPluginHandler() override;
249
250 Q_DISABLE_COPY(qSlicerSubjectHierarchyPluginHandler);
252 friend class PythonQtWrapper_qSlicerSubjectHierarchyPluginHandler; // Allow Python wrapping without enabling direct instantiation
253
254private:
256 static qSlicerSubjectHierarchyPluginHandler* m_Instance;
257};
258
259#endif
Abstract plugin for handling Subject Hierarchy items.
Default Subject Hierarchy plugin to exercise features of the abstract plugin. This plugin must not be...
Q_INVOKABLE void showItemsInView(vtkIdList *itemIDsToShow, vtkMRMLAbstractViewNode *viewNode)
Show a list of items in a selected view (used for drag&drop of items into a view node)
Q_INVOKABLE QList< qSlicerSubjectHierarchyAbstractPlugin * > registeredPlugins()
Get list of registered plugins.
QList< qSlicerSubjectHierarchyAbstractPlugin * > pluginsForReparentingItemInSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID)
Q_INVOKABLE QString dumpContextMenuActions()
Q_INVOKABLE qSlicerSubjectHierarchyPluginLogic * pluginLogic()
Get plugin logic.
qSlicerSubjectHierarchyAbstractPlugin * findAndSetOwnerPluginForSubjectHierarchyItem(vtkIdType itemID)
Q_INVOKABLE vtkMRMLSubjectHierarchyNode * subjectHierarchyNode() const
Get subject hierarchy node.
Q_INVOKABLE vtkMRMLScene * mrmlScene() const
Get MRML scene.
Q_INVOKABLE QList< qSlicerSubjectHierarchyAbstractPlugin * > allPlugins()
Returns all plugins (registered plugins and default plugin)
Q_INVOKABLE void setPluginLogic(qSlicerSubjectHierarchyPluginLogic *pluginLogic)
Set plugin logic.
vtkSmartPointer< vtkCallbackCommand > m_CallBack
Callback handling deletion of the subject hierarchy node.
Q_INVOKABLE void setDisplayPatientIDInSubjectHierarchyItemName(bool on)
static Q_INVOKABLE qSlicerSubjectHierarchyPluginHandler * instance()
Q_INVOKABLE qSlicerSubjectHierarchyAbstractPlugin * pluginByName(QString name)
Q_INVOKABLE qSlicerSubjectHierarchyDefaultPlugin * defaultPlugin()
Get default plugin instance.
Q_INVOKABLE void setAutoDeleteSubjectHierarchyChildren(bool flag)
qSlicerSubjectHierarchyAbstractPlugin * findOwnerPluginForSubjectHierarchyItem(vtkIdType itemID)
qSlicerSubjectHierarchyDefaultPlugin * m_DefaultPlugin
static void onSubjectHierarchyNodeEvent(vtkObject *caller, unsigned long event, void *clientData, void *callData)
Handle subject hierarchy node events.
Q_INVOKABLE void setCurrentItems(QList< vtkIdType > items)
QList< qSlicerSubjectHierarchyAbstractPlugin * > pluginsForAddingNodeToSubjectHierarchy(vtkMRMLNode *node, vtkIdType parentItemID=vtkMRMLSubjectHierarchyNode::INVALID_ITEM_ID)
Q_INVOKABLE void setDisplayStudyIDInSubjectHierarchyItemName(bool on)
Q_INVOKABLE void setCurrentTreeView(qMRMLSubjectHierarchyTreeView *treeView)
Q_INVOKABLE qMRMLSubjectHierarchyTreeView * currentTreeView() const
Get current tree view.
qSlicerSubjectHierarchyPluginLogic * m_PluginLogic
Plugin logic.
Q_INVOKABLE qSlicerSubjectHierarchyAbstractPlugin * getOwnerPluginForSubjectHierarchyItem(vtkIdType itemID)
Q_INVOKABLE vtkIdType currentItem() const
qSlicerSubjectHierarchyAbstractPlugin * selectPluginFromDialog(QString textToDisplay, QList< qSlicerSubjectHierarchyAbstractPlugin * > candidatePlugins)
QDateTime LastPluginRegistrationTime
Timestamp of the last plugin registration. Used to allow context menus be repopulated if needed.
Q_INVOKABLE void setDisplayPatientBirthDateInSubjectHierarchyItemName(bool on)
void setMRMLScene(vtkMRMLScene *scene)
Set MRML scene.
void observeSubjectHierarchyNode(vtkMRMLSubjectHierarchyNode *shNode)
vtkWeakPointer< vtkMRMLScene > m_MRMLScene
MRML scene (to get new subject hierarchy node if the stored one is deleted)
Q_INVOKABLE bool registerPlugin(qSlicerSubjectHierarchyAbstractPlugin *plugin)
qMRMLSubjectHierarchyTreeView * m_CurrentTreeView
Most recently right-clicked subject hierarchy tree view.
Q_INVOKABLE QList< vtkIdType > currentItems() const
QList< qSlicerSubjectHierarchyAbstractPlugin * > m_RegisteredPlugins
List of registered plugin instances.
Q_INVOKABLE void setCurrentItem(vtkIdType itemID)
Q_INVOKABLE void setDisplayStudyDateInSubjectHierarchyItemName(bool on)
Qt-based logic class to exercise Qt-related logic functions. The Subject hierarchy plugin mechanism a...
Abstract MRML node to represent a view. The class holds the properties common to any view type (3D,...
Abstract Superclass for all specific types of MRML nodes.
A set of MRML Nodes that supports serialization and undo/redo.
MRML node to represent a complete subject hierarchy tree.