Slicer 5.4
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;
30public:
32 qSlicerIOManager(QObject* parent = nullptr);
34
45 Q_INVOKABLE bool openDialog(qSlicerIO::IOFileType fileType,
48 vtkCollection* loadedNodes = nullptr);
49
50 void addHistory(const QString& path);
51 const QStringList& history()const;
52
53 void setFavorites(const QList<QUrl>& urls);
54 const QList<QUrl>& favorites()const;
55
59
66
71 Q_INVOKABLE bool loadNodes(const qSlicerIO::IOFileType& fileType, const qSlicerIO::IOProperties& parameters,
72 vtkCollection* loadedNodes = nullptr, vtkMRMLMessageCollection* userMessages = nullptr) override;
76 bool loadNodes(const QList<qSlicerIO::IOProperties>& files, vtkCollection* loadedNodes = nullptr,
77 vtkMRMLMessageCollection* userMessages = nullptr) override;
78
84 Q_INVOKABLE static void showLoadNodesResultDialog(bool success, vtkMRMLMessageCollection* userMessages);
85
89 void dragEnterEvent(QDragEnterEvent *event);
90
97 void dropEvent(QDropEvent *event);
98
99public slots:
100
105 inline bool openAddDataDialog();
106 inline bool openAddDataDialog(QString fileName);
107 inline bool openAddVolumeDialog();
108 inline bool openAddVolumesDialog();
109 inline bool openAddModelDialog();
110 inline bool openAddScalarOverlayDialog();
111 inline bool openAddTransformDialog();
112 inline bool openAddColorTableDialog();
113 inline bool openAddFiducialDialog();
114 inline bool openAddMarkupsDialog();
115 inline bool openAddFiberBundleDialog();
116 inline bool openSaveDataDialog();
117
118protected slots:
121
122protected:
123 friend class qSlicerFileDialog;
125protected:
126 QScopedPointer<qSlicerIOManagerPrivate> d_ptr;
127
128private:
129 Q_DECLARE_PRIVATE(qSlicerIOManager);
130 Q_DISABLE_COPY(qSlicerIOManager);
131};
132
133//------------------------------------------------------------------------------
135{
136 qSlicerIO::IOProperties ioProperties;
137 ioProperties["fileName"] = fileName;
138 return this->openDialog(QString("NoFile"), qSlicerFileDialog::Read, ioProperties);
139}
140
141//------------------------------------------------------------------------------
143{
144 return this->openDialog(QString("NoFile"), qSlicerFileDialog::Read);
145}
146
147//-----------------------------------------------------------------------------
149{
150 return this->openDialog(QString("VolumeFile"), qSlicerFileDialog::Read);
151}
152
153//-----------------------------------------------------------------------------
155{
156 qSlicerIO::IOProperties ioProperties;
157 ioProperties["multipleFiles"] = true;
158 return this->openDialog(QString("VolumeFile"), qSlicerFileDialog::Read, ioProperties);
159}
160
161//-----------------------------------------------------------------------------
163{
164 return this->openDialog(QString("ModelFile"), qSlicerFileDialog::Read);
165}
166
167//-----------------------------------------------------------------------------
169{
170 return this->openDialog(QString("ScalarOverlayFile"), qSlicerFileDialog::Read);
171}
172
173//-----------------------------------------------------------------------------
175{
176 return this->openDialog(QString("TransformFile"), qSlicerFileDialog::Read);
177}
178
179//-----------------------------------------------------------------------------
181{
182 return this->openDialog(QString("ColorTableFile"), qSlicerFileDialog::Read);
183}
184
185//-----------------------------------------------------------------------------
187{
188 return this->openDialog(QString("FiducialListFile"), qSlicerFileDialog::Read);
189}
190
191//-----------------------------------------------------------------------------
193{
194 return this->openDialog(QString("MarkupsFiducials"), qSlicerFileDialog::Read);
195}
196
197//-----------------------------------------------------------------------------
199{
200 return this->openDialog(QString("FiberBundleFile"), qSlicerFileDialog::Read);
201}
202
203//------------------------------------------------------------------------------
205{
206 return this->openDialog(QString("NoFile"), qSlicerFileDialog::Write);
207}
208
209#endif
const QList< qSlicerFileReader * > & readers() const
Returns the list of registered readers.
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)
QString IOFileType
Definition qSlicerIO.h:52