Slicer  4.10
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
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"
14 #include "qSlicerCoreIOManager.h"
15 #include "qSlicerFileDialog.h"
16 
17 #include "qSlicerBaseQTGUIExport.h"
18 
20 class QDragEnterEvent;
21 class QDropEvent;
22 class QWidget;
23 
24 class qSlicerIOManagerPrivate;
25 
26 class Q_SLICER_BASE_QTGUI_EXPORT qSlicerIOManager : public qSlicerCoreIOManager
27 {
28  Q_OBJECT;
29  QVTK_OBJECT;
30 public:
32  qSlicerIOManager(QObject* parent = 0);
33  virtual ~qSlicerIOManager();
34 
45  Q_INVOKABLE bool openDialog(qSlicerIO::IOFileType fileType,
48  vtkCollection* loadedNodes = 0);
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 
58  void registerDialog(qSlicerFileDialog* dialog);
59 
64  Q_INVOKABLE virtual bool loadNodes(const qSlicerIO::IOFileType& fileType,
65  const qSlicerIO::IOProperties& parameters,
66  vtkCollection* loadedNodes = 0);
70  virtual bool loadNodes(const QList<qSlicerIO::IOProperties>& files,
71  vtkCollection* loadedNodes = 0);
72 
76  void dragEnterEvent(QDragEnterEvent *event);
77 
84  void dropEvent(QDropEvent *event);
85 
86 public slots:
87 
88  void openScreenshotDialog();
89  void openSceneViewsDialog();
90  bool openLoadSceneDialog();
91  bool openAddSceneDialog();
92  inline bool openAddDataDialog();
93  inline bool openAddDataDialog(QString fileName);
94  inline bool openAddVolumeDialog();
95  inline bool openAddVolumesDialog();
96  inline bool openAddModelDialog();
97  inline bool openAddScalarOverlayDialog();
98  inline bool openAddTransformDialog();
99  inline bool openAddColorTableDialog();
100  inline bool openAddFiducialDialog();
101  inline bool openAddMarkupsDialog();
102  inline bool openAddFiberBundleDialog();
103  inline bool openSaveDataDialog();
104 
105 protected slots:
106  void updateProgressDialog();
107 
108 protected:
109  friend class qSlicerFileDialog;
111 protected:
112  QScopedPointer<qSlicerIOManagerPrivate> d_ptr;
113 
114 private:
115  Q_DECLARE_PRIVATE(qSlicerIOManager);
116  Q_DISABLE_COPY(qSlicerIOManager);
117 };
118 
119 //------------------------------------------------------------------------------
121 {
122  qSlicerIO::IOProperties ioProperties;
123  ioProperties["fileName"] = fileName;
124  return this->openDialog(QString("NoFile"), qSlicerFileDialog::Read, ioProperties);
125 }
126 
127 //------------------------------------------------------------------------------
129 {
130  return this->openDialog(QString("NoFile"), qSlicerFileDialog::Read);
131 }
132 
133 //-----------------------------------------------------------------------------
135 {
136  return this->openDialog(QString("VolumeFile"), qSlicerFileDialog::Read);
137 }
138 
139 //-----------------------------------------------------------------------------
141 {
142  qSlicerIO::IOProperties ioProperties;
143  ioProperties["multipleFiles"] = true;
144  return this->openDialog(QString("VolumeFile"), qSlicerFileDialog::Read, ioProperties);
145 }
146 
147 //-----------------------------------------------------------------------------
149 {
150  return this->openDialog(QString("ModelFile"), qSlicerFileDialog::Read);
151 }
152 
153 //-----------------------------------------------------------------------------
155 {
156  return this->openDialog(QString("ScalarOverlayFile"), qSlicerFileDialog::Read);
157 }
158 
159 //-----------------------------------------------------------------------------
161 {
162  return this->openDialog(QString("TransformFile"), qSlicerFileDialog::Read);
163 }
164 
165 //-----------------------------------------------------------------------------
167 {
168  return this->openDialog(QString("ColorTableFile"), qSlicerFileDialog::Read);
169 }
170 
171 //-----------------------------------------------------------------------------
173 {
174  return this->openDialog(QString("FiducialListFile"), qSlicerFileDialog::Read);
175 }
176 
177 //-----------------------------------------------------------------------------
179 {
180  return this->openDialog(QString("MarkupsFiducials"), qSlicerFileDialog::Read);
181 }
182 
183 //-----------------------------------------------------------------------------
185 {
186  return this->openDialog(QString("FiberBundleFile"), qSlicerFileDialog::Read);
187 }
188 
189 //------------------------------------------------------------------------------
191 {
192  return this->openDialog(QString("NoFile"), qSlicerFileDialog::Write);
193 }
194 
195 #endif
virtual Q_INVOKABLE bool loadNodes(const qSlicerIO::IOFileType &fileType, const QVariantMap &parameters, vtkCollection *loadedNodes=0)
QScopedPointer< qSlicerIOManagerPrivate > d_ptr
const QList< qSlicerFileReader * > & readers() const
Returns the list of registered readers.
Q_INVOKABLE bool openDialog(qSlicerIO::IOFileType fileType, qSlicerFileDialog::IOAction action, qSlicerIO::IOProperties ioProperties=qSlicerIO::IOProperties(), vtkCollection *loadedNodes=0)
bool openAddScalarOverlayDialog()
bool openAddFiberBundleDialog()
QString IOFileType
Definition: qSlicerIO.h:50
qSlicerCoreIOManager Superclass
bool openAddColorTableDialog()