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
qSlicerScriptedFileReader.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 __qSlicerScriptedFileReader_h
22#define __qSlicerScriptedFileReader_h
23
24// Slicer includes
25#include "qSlicerFileReader.h"
26#include "qSlicerBaseQTCoreExport.h"
27
28// Forward Declare PyObject*
29#ifndef PyObject_HEAD
30struct _object;
31typedef _object PyObject;
32#endif
33class qSlicerScriptedFileReaderPrivate;
34class vtkObject;
35
36class Q_SLICER_BASE_QTCORE_EXPORT qSlicerScriptedFileReader
37 : public qSlicerFileReader
38{
39 Q_OBJECT
40
42 Q_PROPERTY(QStringList loadedNodes READ loadedNodes WRITE setLoadedNodes)
43
44public:
46 qSlicerScriptedFileReader(QObject* parent = nullptr);
48
49 QString pythonSource()const;
50
53 bool setPythonSource(const QString& filePath, const QString& className = QLatin1String(""), bool missingClassIsExpected = true);
54
56 Q_INVOKABLE PyObject* self() const;
57
60 QString description()const override;
61
64 IOFileType fileType()const override;
65
68 QStringList extensions()const override;
69
72 bool canLoadFile(const QString& file)const override;
73
76 double canLoadFileConfidence(const QString& file)const override;
77
79 bool load(const qSlicerIO::IOProperties& properties) override;
80
85 QStringList loadedNodes()const override {
87 };
88 void setLoadedNodes(const QStringList& nodes) override {
90 };
91
92protected:
93 QScopedPointer<qSlicerScriptedFileReaderPrivate> d_ptr;
94
95private:
96 Q_DECLARE_PRIVATE(qSlicerScriptedFileReader);
97 Q_DISABLE_COPY(qSlicerScriptedFileReader);
98};
99
100#endif
virtual void setLoadedNodes(const QStringList &nodes)
qSlicerFileReader(QObject *parent=nullptr)
virtual Q_INVOKABLE QStringList loadedNodes() const
QString IOFileType
Definition qSlicerIO.h:52
QVariantMap IOProperties
Definition qSlicerIO.h:53
QScopedPointer< qSlicerScriptedFileReaderPrivate > d_ptr
Q_INVOKABLE PyObject * self() const
Convenience method allowing to retrieve the associated scripted instance.
QStringList loadedNodes
This property allows the reader to report back what nodes it was able to load.
bool canLoadFile(const QString &file) const override
~qSlicerScriptedFileReader() override
qSlicerScriptedFileReader(QObject *parent=nullptr)
bool load(const qSlicerIO::IOProperties &properties) override
QString pythonSource() const
double canLoadFileConfidence(const QString &file) const override
bool setPythonSource(const QString &filePath, const QString &className=QLatin1String(""), bool missingClassIsExpected=true)
IOFileType fileType() const override
QStringList extensions() const override
QString description() const override
QStringList loadedNodes() const override
void setLoadedNodes(const QStringList &nodes) override
_object PyObject