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
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
33class vtkMRMLNode;
34class vtkMRMLScene;
35class qMRMLNodeFactoryPrivate;
36
40class QMRML_WIDGETS_EXPORT qMRMLNodeFactory : public QObject
41{
42 Q_OBJECT
43public:
44
46 typedef QHash<QString,QString> AttributeType;
47
49 typedef QObject Superclass;
50 explicit qMRMLNodeFactory(QObject* parent = nullptr);
52
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
92public slots:
96
97signals:
112
113protected:
114 QScopedPointer<qMRMLNodeFactoryPrivate> d_ptr;
115
116private:
117 Q_DECLARE_PRIVATE(qMRMLNodeFactory);
118 Q_DISABLE_COPY(qMRMLNodeFactory);
119};
120
121#endif
vtkMRMLScene * mrmlScene() const
void nodeInstantiated(vtkMRMLNode *node)
Q_INVOKABLE void addAttribute(const QString &attributeName, const QString &attributeValue)
QObject Superclass
Constructors.
Q_INVOKABLE void removeAttribute(const QString &attributeName)
Q_INVOKABLE QString attribute(const QString &attributeName) const
Q_INVOKABLE void setBaseName(const QString &className, const QString &baseName)
Base name used to generate a name for create node.
void nodeAdded(vtkMRMLNode *node)
QHash< QString, QString > AttributeType
Convenient typedef.
void setMRMLScene(vtkMRMLScene *mrmlScene)
Set MRML scene.
Q_INVOKABLE QString baseName(const QString &className) const
void nodeInitialized(vtkMRMLNode *node)
QScopedPointer< qMRMLNodeFactoryPrivate > d_ptr
static vtkMRMLNode * createNode(vtkMRMLScene *scene, const QString &className, const AttributeType &attributes=AttributeType())
Convenient method allowing to create a new node and add it to the scene.
qMRMLNodeFactory(QObject *parent=nullptr)
~qMRMLNodeFactory() override
Q_INVOKABLE vtkMRMLNode * createNode(const QString &className)
Abstract Superclass for all specific types of MRML nodes.
A set of MRML Nodes that supports serialization and undo/redo.