Slicer  4.10
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
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 <QObject>
39 #include <QList>
40 #include <QString>
41 
42 class vtkMRMLScene;
43 class vtkCallbackCommand;
47 class qSlicerSubjectHierarchyPluginHandlerCleanup;
48 
49 
54 class Q_SLICER_MODULE_SUBJECTHIERARCHY_WIDGETS_EXPORT qSlicerSubjectHierarchyPluginHandler : public QObject
55 {
56  Q_OBJECT
57 
62  Q_PROPERTY (bool autoDeleteSubjectHierarchyChildren READ autoDeleteSubjectHierarchyChildren WRITE setAutoDeleteSubjectHierarchyChildren)
66  Q_PROPERTY (bool displayPatientIDInSubjectHierarchyItemName READ displayPatientIDInSubjectHierarchyItemName WRITE setDisplayPatientIDInSubjectHierarchyItemName)
70  Q_PROPERTY (bool displayPatientBirthDateInSubjectHierarchyItemName READ displayPatientBirthDateInSubjectHierarchyItemName WRITE setDisplayPatientBirthDateInSubjectHierarchyItemName)
74  Q_PROPERTY (bool displayStudyIDInSubjectHierarchyItemName READ displayStudyIDInSubjectHierarchyItemName WRITE setDisplayStudyIDInSubjectHierarchyItemName)
78  Q_PROPERTY (bool displayStudyDateInSubjectHierarchyItemName READ displayStudyDateInSubjectHierarchyItemName WRITE setDisplayStudyDateInSubjectHierarchyItemName)
79 
80 public:
83  Q_INVOKABLE static qSlicerSubjectHierarchyPluginHandler* instance();
84 
86  static void setInstance(qSlicerSubjectHierarchyPluginHandler* instance);
87 
89  void setSubjectHierarchyNode(vtkMRMLSubjectHierarchyNode* shNode);
91  Q_INVOKABLE vtkMRMLSubjectHierarchyNode* subjectHierarchyNode()const;
93  void setMRMLScene(vtkMRMLScene* scene);
95  Q_INVOKABLE vtkMRMLScene* mrmlScene()const;
96 
98  Q_INVOKABLE qSlicerSubjectHierarchyPluginLogic* pluginLogic();
100  Q_INVOKABLE void setPluginLogic(qSlicerSubjectHierarchyPluginLogic* pluginLogic);
101 
105  Q_INVOKABLE void setCurrentItem(vtkIdType itemID);
106 
113  Q_INVOKABLE vtkIdType currentItem();
114 
118  Q_INVOKABLE void setCurrentItems(QList<vtkIdType> items);
119 
123  Q_INVOKABLE QList<vtkIdType> currentItems();
124 
125  Q_INVOKABLE bool autoDeleteSubjectHierarchyChildren()const;
126  Q_INVOKABLE void setAutoDeleteSubjectHierarchyChildren(bool flag);
127  Q_INVOKABLE bool displayPatientIDInSubjectHierarchyItemName()const;
128  Q_INVOKABLE void setDisplayPatientIDInSubjectHierarchyItemName(bool on);
129  Q_INVOKABLE bool displayPatientBirthDateInSubjectHierarchyItemName()const;
130  Q_INVOKABLE void setDisplayPatientBirthDateInSubjectHierarchyItemName(bool on);
131  Q_INVOKABLE bool displayStudyIDInSubjectHierarchyItemName()const;
132  Q_INVOKABLE void setDisplayStudyIDInSubjectHierarchyItemName(bool on);
133  Q_INVOKABLE bool displayStudyDateInSubjectHierarchyItemName()const;
134  Q_INVOKABLE void setDisplayStudyDateInSubjectHierarchyItemName(bool on);
135 
136 public:
139  Q_INVOKABLE bool registerPlugin(qSlicerSubjectHierarchyAbstractPlugin* plugin);
140 
142  Q_INVOKABLE QList<qSlicerSubjectHierarchyAbstractPlugin*> registeredPlugins() { return m_RegisteredPlugins; };
143 
145  Q_INVOKABLE qSlicerSubjectHierarchyDefaultPlugin* defaultPlugin();
146 
148  Q_INVOKABLE QList<qSlicerSubjectHierarchyAbstractPlugin*> allPlugins();
149 
152  Q_INVOKABLE qSlicerSubjectHierarchyAbstractPlugin* pluginByName(QString name);
153 
160  QList<qSlicerSubjectHierarchyAbstractPlugin*> pluginsForAddingNodeToSubjectHierarchy(
161  vtkMRMLNode* node,
162  vtkIdType parentItemID=vtkMRMLSubjectHierarchyNode::INVALID_ITEM_ID );
163 
169  QList<qSlicerSubjectHierarchyAbstractPlugin*> pluginsForReparentingItemInSubjectHierarchy(
170  vtkIdType itemID, vtkIdType parentItemID );
171 
176  qSlicerSubjectHierarchyAbstractPlugin* findOwnerPluginForSubjectHierarchyItem(vtkIdType itemID);
177 
181  qSlicerSubjectHierarchyAbstractPlugin* findAndSetOwnerPluginForSubjectHierarchyItem(vtkIdType itemID);
182 
185  Q_INVOKABLE qSlicerSubjectHierarchyAbstractPlugin* getOwnerPluginForSubjectHierarchyItem(vtkIdType itemID);
186 
193  qSlicerSubjectHierarchyAbstractPlugin* selectPluginFromDialog(QString textToDisplay, QList<qSlicerSubjectHierarchyAbstractPlugin*> candidatePlugins);
194 
195 protected:
197  static void onSubjectHierarchyNodeEvent(vtkObject* caller, unsigned long event, void* clientData, void* callData);
198 
199 protected:
202 
206 
210 
212  vtkWeakPointer<vtkMRMLSubjectHierarchyNode> m_SubjectHierarchyNode;
214  vtkWeakPointer<vtkMRMLScene> m_MRMLScene;
215 
218 
220  vtkSmartPointer<vtkCallbackCommand> m_CallBack;
221 
222 public:
225  qSlicerSubjectHierarchyPluginHandler(QObject* parent=NULL);
226 
229 
230 private:
231  Q_DISABLE_COPY(qSlicerSubjectHierarchyPluginHandler);
232  friend class qSlicerSubjectHierarchyPluginHandlerCleanup;
233 
234 private:
236  static qSlicerSubjectHierarchyPluginHandler* m_Instance;
237 };
238 
239 #endif
vtkWeakPointer< vtkMRMLSubjectHierarchyNode > m_SubjectHierarchyNode
Subject hierarchy node.
QList< qSlicerSubjectHierarchyAbstractPlugin * > m_RegisteredPlugins
List of registered plugin instances.
vtkSmartPointer< vtkCallbackCommand > m_CallBack
Callback handling deletion of the subject hierarchy node.
vtkWeakPointer< vtkMRMLScene > m_MRMLScene
MRML scene (to get new subject hierarchy node if the stored one is deleted)
Default Subject Hierarchy plugin to exercise features of the abstract plugin. This plugin must not be...
qSlicerSubjectHierarchyDefaultPlugin * m_DefaultPlugin
Abstract plugin for handling Subject Hierarchy items.
MRML node to represent a complete subject hierarchy tree.
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:54
qSlicerSubjectHierarchyPluginLogic * m_PluginLogic
Plugin logic.
Qt-based logic class to exercise Qt-related logic functions. The Subject hierarchy plugin mechanism a...
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:138
Singleton class managing Subject Hierarchy plugins.