Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
qSlicerIOManager.h
Go to the documentation of this file.
1#ifndef __qSlicerIOManager_h
2#define __qSlicerIOManager_h
3
4// Qt includes
5#include <QList>
6#include <QString>
7#include <QUrl>
8
9// CTK includes
10#include <ctkVTKObject.h>
11
12// SlicerQ includes
13#include "qSlicerApplication.h"
15#include "qSlicerFileDialog.h"
16
17#include "qSlicerBaseQTGUIExport.h"
18
20class QDragEnterEvent;
21class QDropEvent;
22class QWidget;
23
24class qSlicerIOManagerPrivate;
25
26class Q_SLICER_BASE_QTGUI_EXPORT qSlicerIOManager : public qSlicerCoreIOManager
27{
28 Q_OBJECT;
29 QVTK_OBJECT;
30
31public:
33 qSlicerIOManager(QObject* parent = nullptr);
35
49 vtkCollection* loadedNodes = nullptr);
50
51 void addHistory(const QString& path);
52 const QStringList& history() const;
53
54 void setFavorites(const QList<QUrl>& urls);
55 const QList<QUrl>& favorites() const;
56
60
67
72 Q_INVOKABLE bool loadNodes(const qSlicerIO::IOFileType& fileType,
73 const qSlicerIO::IOProperties& parameters,
74 vtkCollection* loadedNodes = nullptr,
75 vtkMRMLMessageCollection* userMessages = nullptr) override;
79 bool loadNodes(const QList<qSlicerIO::IOProperties>& files, vtkCollection* loadedNodes = nullptr, vtkMRMLMessageCollection* userMessages = nullptr) override;
80
86 Q_INVOKABLE static void showLoadNodesResultDialog(bool success, vtkMRMLMessageCollection* userMessages);
87
91 void dragEnterEvent(QDragEnterEvent* event);
92
99 void dropEvent(QDropEvent* event);
100
101public slots:
102
107 inline bool openAddDataDialog();
108 inline bool openAddDataDialog(QString fileName);
109 inline bool openAddVolumeDialog();
110 inline bool openAddVolumesDialog();
111 inline bool openAddModelDialog();
112 inline bool openAddScalarOverlayDialog();
113 inline bool openAddTransformDialog();
114 inline bool openAddColorTableDialog();
115 inline bool openAddFiducialDialog();
116 inline bool openAddMarkupsDialog();
117 inline bool openAddFiberBundleDialog();
118 inline bool openSaveDataDialog();
119
120protected slots:
123
124protected:
125 friend class qSlicerFileDialog;
127
128protected:
129 QScopedPointer<qSlicerIOManagerPrivate> d_ptr;
130
131private:
132 Q_DECLARE_PRIVATE(qSlicerIOManager);
133 Q_DISABLE_COPY(qSlicerIOManager);
134};
135
136//------------------------------------------------------------------------------
138{
139 qSlicerIO::IOProperties ioProperties;
140 ioProperties["fileName"] = fileName;
141 return this->openDialog(QString("NoFile"), qSlicerFileDialog::Read, ioProperties);
142}
143
144//------------------------------------------------------------------------------
146{
147 return this->openDialog(QString("NoFile"), qSlicerFileDialog::Read);
148}
149
150//-----------------------------------------------------------------------------
152{
153 return this->openDialog(QString("VolumeFile"), qSlicerFileDialog::Read);
154}
155
156//-----------------------------------------------------------------------------
158{
159 qSlicerIO::IOProperties ioProperties;
160 ioProperties["multipleFiles"] = true;
161 return this->openDialog(QString("VolumeFile"), qSlicerFileDialog::Read, ioProperties);
162}
163
164//-----------------------------------------------------------------------------
166{
167 return this->openDialog(QString("ModelFile"), qSlicerFileDialog::Read);
168}
169
170//-----------------------------------------------------------------------------
172{
173 return this->openDialog(QString("ScalarOverlayFile"), qSlicerFileDialog::Read);
174}
175
176//-----------------------------------------------------------------------------
178{
179 return this->openDialog(QString("TransformFile"), qSlicerFileDialog::Read);
180}
181
182//-----------------------------------------------------------------------------
184{
185 return this->openDialog(QString("ColorTableFile"), qSlicerFileDialog::Read);
186}
187
188//-----------------------------------------------------------------------------
190{
191 return this->openDialog(QString("FiducialListFile"), qSlicerFileDialog::Read);
192}
193
194//-----------------------------------------------------------------------------
196{
197 return this->openDialog(QString("MarkupsFiducials"), qSlicerFileDialog::Read);
198}
199
200//-----------------------------------------------------------------------------
202{
203 return this->openDialog(QString("FiberBundleFile"), qSlicerFileDialog::Read);
204}
205
206//------------------------------------------------------------------------------
208{
209 return this->openDialog(QString("NoFile"), qSlicerFileDialog::Write);
210}
211
212#endif
const QList< qSlicerFileReader * > & readers() const
Returns the list of registered readers.
Q_INVOKABLE qSlicerIO::IOFileType fileType(const QString &file) const
Return the most likely file type (SegmentationFile, TextFile, ...) for reading a file.
qSlicerCoreIOManager(QObject *parent=nullptr)
void updateProgressDialog()
Q_INVOKABLE bool loadNodes(const qSlicerIO::IOFileType &fileType, const qSlicerIO::IOProperties &parameters, vtkCollection *loadedNodes=nullptr, vtkMRMLMessageCollection *userMessages=nullptr) override
void execDelayedFileDialog()
Q_INVOKABLE bool isDialogRegistered(qSlicerIO::IOFileType fileType, qSlicerFileDialog::IOAction action) const
void openSceneViewsDialog()
static Q_INVOKABLE void showLoadNodesResultDialog(bool success, vtkMRMLMessageCollection *userMessages)
const QList< QUrl > & favorites() const
Q_INVOKABLE bool openDialog(qSlicerIO::IOFileType fileType, qSlicerFileDialog::IOAction action, qSlicerIO::IOProperties ioProperties=qSlicerIO::IOProperties(), vtkCollection *loadedNodes=nullptr)
qSlicerIOManager(QObject *parent=nullptr)
const QStringList & history() const
void dragEnterEvent(QDragEnterEvent *event)
bool openAddSceneDialog()
bool loadNodes(const QList< qSlicerIO::IOProperties > &files, vtkCollection *loadedNodes=nullptr, vtkMRMLMessageCollection *userMessages=nullptr) override
QScopedPointer< qSlicerIOManagerPrivate > d_ptr
void setFavorites(const QList< QUrl > &urls)
qSlicerCoreIOManager Superclass
void addHistory(const QString &path)
void dropEvent(QDropEvent *event)
bool openAddScalarOverlayDialog()
bool openLoadSceneDialog()
void openScreenshotDialog()
~qSlicerIOManager() override
void registerDialog(qSlicerFileDialog *dialog)
friend class qSlicerFileDialog
QString IOFileType
Definition qSlicerIO.h:52
QVariantMap IOProperties
Definition qSlicerIO.h:53