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
qSlicerScriptedFileWriter.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 __qSlicerScriptedFileWriter_h
22#define __qSlicerScriptedFileWriter_h
23
24// Slicer includes
25#include "qSlicerFileWriter.h"
26#include "qSlicerBaseQTCoreExport.h"
27
28// Forward Declare PyObject*
29#ifndef PyObject_HEAD
30struct _object;
31typedef _object PyObject;
32#endif
33class qSlicerScriptedFileWriterPrivate;
34
35class Q_SLICER_BASE_QTCORE_EXPORT qSlicerScriptedFileWriter
36 : public qSlicerFileWriter
37{
38 Q_OBJECT
39
41 Q_PROPERTY(QStringList writtenNodes READ writtenNodes WRITE setWrittenNodes)
42
43public:
45 qSlicerScriptedFileWriter(QObject* parent = nullptr);
47
48 QString pythonSource()const;
49
52 bool setPythonSource(const QString& filePath, const QString& className = QLatin1String(""), bool missingClassIsExpected = true);
53
55 Q_INVOKABLE PyObject* self() const;
56
59 QString description()const override;
60
63 IOFileType fileType()const override;
64
67 bool canWriteObject(vtkObject* object)const override;
68
71 double canWriteObjectConfidence(vtkObject* object)const override;
72
75 QStringList extensions(vtkObject* object)const override;
76
79 bool write(const qSlicerIO::IOProperties& properties) override;
80
83 void addWrittenNode(const QString& writtenNode);
84
89 QStringList writtenNodes()const override {
91 };
92 void setWrittenNodes(const QStringList& nodes) override {
94 };
95
96protected:
97 QScopedPointer<qSlicerScriptedFileWriterPrivate> d_ptr;
98
99private:
100 Q_DECLARE_PRIVATE(qSlicerScriptedFileWriter);
101 Q_DISABLE_COPY(qSlicerScriptedFileWriter);
102};
103
104#endif
qSlicerFileWriter(QObject *parent=nullptr)
virtual QStringList writtenNodes() const
virtual void setWrittenNodes(const QStringList &nodes)
QString IOFileType
Definition qSlicerIO.h:52
QVariantMap IOProperties
Definition qSlicerIO.h:53
Q_INVOKABLE PyObject * self() const
Convenience method allowing to retrieve the associated scripted instance.
QStringList extensions(vtkObject *object) const override
bool write(const qSlicerIO::IOProperties &properties) override
~qSlicerScriptedFileWriter() override
QStringList writtenNodes() const override
QString description() const override
bool setPythonSource(const QString &filePath, const QString &className=QLatin1String(""), bool missingClassIsExpected=true)
QString pythonSource() const
double canWriteObjectConfidence(vtkObject *object) const override
IOFileType fileType() const override
qSlicerScriptedFileWriter(QObject *parent=nullptr)
bool canWriteObject(vtkObject *object) const override
QStringList writtenNodes
This property allows the writer to report back what nodes it was able to write.
void setWrittenNodes(const QStringList &nodes) override
void addWrittenNode(const QString &writtenNode)
QScopedPointer< qSlicerScriptedFileWriterPrivate > d_ptr
_object PyObject