Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qMRMLNodeFactory.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Copyright (c) Kitware Inc.
6 
7  See COPYRIGHT.txt
8  or http://www.slicer.org/copyright/copyright.txt for details.
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16  This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc.
17  and was partially funded by NIH grant 3P41RR013218-12S1
18 
19 ==============================================================================*/
20 
21 #ifndef __qMRMLNodeFactory_h
22 #define __qMRMLNodeFactory_h
23 
24 // Qt includes
25 #include <QObject>
26 #include <QHash>
27 
28 // CTK includes
29 #include <ctkPimpl.h>
30 
31 #include "qMRMLWidgetsExport.h"
32 
33 class vtkMRMLNode;
34 class vtkMRMLScene;
35 class qMRMLNodeFactoryPrivate;
36 
40 class QMRML_WIDGETS_EXPORT qMRMLNodeFactory : public QObject
41 {
42  Q_OBJECT
43 public:
44 
46  typedef QHash<QString,QString> AttributeType;
47 
49  typedef QObject Superclass;
50  explicit qMRMLNodeFactory(QObject* parent = 0);
51  virtual ~qMRMLNodeFactory();
52 
55  vtkMRMLScene* mrmlScene()const;
56 
73  Q_INVOKABLE vtkMRMLNode* createNode(const QString& className);
74 
77  static vtkMRMLNode* createNode(vtkMRMLScene* scene, const QString& className,
78  const AttributeType& attributes = AttributeType());
79 
84  Q_INVOKABLE void addAttribute(const QString& attributeName, const QString& attributeValue);
85  Q_INVOKABLE void removeAttribute(const QString& attributeName);
86  Q_INVOKABLE QString attribute(const QString& attributeName)const;
87 
89  Q_INVOKABLE void setBaseName(const QString& className, const QString& baseName);
90  Q_INVOKABLE QString baseName(const QString& className)const;
91 
92 public slots:
95  void setMRMLScene(vtkMRMLScene* mrmlScene);
96 
97 signals:
101  void nodeInstantiated(vtkMRMLNode* node);
107  void nodeInitialized(vtkMRMLNode* node);
111  void nodeAdded(vtkMRMLNode* node);
112 
113 protected:
114  QScopedPointer<qMRMLNodeFactoryPrivate> d_ptr;
115 
116 private:
117  Q_DECLARE_PRIVATE(qMRMLNodeFactory);
118  Q_DISABLE_COPY(qMRMLNodeFactory);
119 };
120 
121 #endif
QHash< QString, QString > AttributeType
Convenient typedef.
QScopedPointer< qMRMLNodeFactoryPrivate > d_ptr
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:54
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:135
QObject Superclass
Constructors.