Slicer  4.8
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 openAddFiberBundleDialog();
102  inline bool openSaveDataDialog();
103 
104 protected slots:
105  void updateProgressDialog();
106 
107 protected:
108  friend class qSlicerFileDialog;
110 protected:
111  QScopedPointer<qSlicerIOManagerPrivate> d_ptr;
112 
113 private:
114  Q_DECLARE_PRIVATE(qSlicerIOManager);
115  Q_DISABLE_COPY(qSlicerIOManager);
116 };
117 
118 //------------------------------------------------------------------------------
120 {
121  qSlicerIO::IOProperties ioProperties;
122  ioProperties["fileName"] = fileName;
123  return this->openDialog(QString("NoFile"), qSlicerFileDialog::Read, ioProperties);
124 }
125 
126 //------------------------------------------------------------------------------
128 {
129  return this->openDialog(QString("NoFile"), qSlicerFileDialog::Read);
130 }
131 
132 //-----------------------------------------------------------------------------
134 {
135  return this->openDialog(QString("VolumeFile"), qSlicerFileDialog::Read);
136 }
137 
138 //-----------------------------------------------------------------------------
140 {
141  qSlicerIO::IOProperties ioProperties;
142  ioProperties["multipleFiles"] = true;
143  return this->openDialog(QString("VolumeFile"), qSlicerFileDialog::Read, ioProperties);
144 }
145 
146 //-----------------------------------------------------------------------------
148 {
149  return this->openDialog(QString("ModelFile"), qSlicerFileDialog::Read);
150 }
151 
152 //-----------------------------------------------------------------------------
154 {
155  return this->openDialog(QString("ScalarOverlayFile"), qSlicerFileDialog::Read);
156 }
157 
158 //-----------------------------------------------------------------------------
160 {
161  return this->openDialog(QString("TransformFile"), qSlicerFileDialog::Read);
162 }
163 
164 //-----------------------------------------------------------------------------
166 {
167  return this->openDialog(QString("ColorTableFile"), qSlicerFileDialog::Read);
168 }
169 
170 //-----------------------------------------------------------------------------
172 {
173  return this->openDialog(QString("FiducialListFile"), qSlicerFileDialog::Read);
174 }
175 
176 //-----------------------------------------------------------------------------
178 {
179  return this->openDialog(QString("FiberBundleFile"), qSlicerFileDialog::Read);
180 }
181 
182 //------------------------------------------------------------------------------
184 {
185  return this->openDialog(QString("NoFile"), qSlicerFileDialog::Write);
186 }
187 
188 #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.
bool openAddScalarOverlayDialog()
bool openAddFiberBundleDialog()
QString IOFileType
Definition: qSlicerIO.h:50
qSlicerCoreIOManager Superclass
bool openAddColorTableDialog()