Slicer 5.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
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 {
86 return Superclass::loadedNodes();
87 };
88 void setLoadedNodes(const QStringList& nodes) override {
89 Superclass::setLoadedNodes(nodes);
90 };
91
92protected:
93 QScopedPointer<qSlicerScriptedFileReaderPrivate> d_ptr;
94
95private:
96 Q_DECLARE_PRIVATE(qSlicerScriptedFileReader);
97 Q_DISABLE_COPY(qSlicerScriptedFileReader);
98};
99
100#endif
QString IOFileType
Definition qSlicerIO.h:52
QScopedPointer< qSlicerScriptedFileReaderPrivate > d_ptr
Q_INVOKABLE PyObject * self() const
Convenience method allowing to retrieve the associated scripted instance.
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