Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
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:
45 typedef QHash<QString, QString> AttributeType;
46
48 typedef QObject Superclass;
49 explicit qMRMLNodeFactory(QObject* parent = nullptr);
51
55
72 Q_INVOKABLE vtkMRMLNode* createNode(const QString& className);
73
76 static vtkMRMLNode* createNode(vtkMRMLScene* scene, const QString& className, const AttributeType& attributes = AttributeType());
77
82 Q_INVOKABLE void addAttribute(const QString& attributeName, const QString& attributeValue);
83 Q_INVOKABLE void removeAttribute(const QString& attributeName);
84 Q_INVOKABLE QString attribute(const QString& attributeName) const;
85
87 Q_INVOKABLE void setBaseName(const QString& className, const QString& baseName);
88 Q_INVOKABLE QString baseName(const QString& className) const;
89
90public slots:
94
95signals:
110
111protected:
112 QScopedPointer<qMRMLNodeFactoryPrivate> d_ptr;
113
114private:
115 Q_DECLARE_PRIVATE(qMRMLNodeFactory);
116 Q_DISABLE_COPY(qMRMLNodeFactory);
117};
118
119#endif
vtkMRMLScene * mrmlScene() const
void nodeInstantiated(vtkMRMLNode *node)
Q_INVOKABLE void addAttribute(const QString &attributeName, const QString &attributeValue)
QHash< QString, QString > AttributeType
Convenient typedef.
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)
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.