Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkIOUtil.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef _QmitkIOUtil__h_
18 #define _QmitkIOUtil__h_
19 
20 #include "MitkQtWidgetsExports.h"
21 
22 // std
23 #include <string>
24 
25 // mitk includes
26 #include <mitkBaseData.h>
27 #include <mitkCommon.h>
28 #include <mitkDataNode.h>
30 #include <mitkIOUtil.h>
31 #include <mitkImage.h>
32 #include <mitkPointSet.h>
33 #include <mitkSurface.h>
34 
35 // Qt
36 #include <QList>
37 #include <QPair>
38 #include <QScopedPointer>
39 #include <QString>
40 
41 class QWidget;
42 class QString;
43 class QStringList;
44 
45 namespace mitk
46 {
47  class DataStorage;
48  class MimeType;
49  struct IFileReader;
50 }
51 
56 {
57 public:
59  {
60  public:
61  static mitk::MimeType ALL_MIMETYPE();
62 
63  SaveFilter(const SaveFilter &other);
64 
65  SaveFilter(const SaveInfo &saveInfo);
66 
67  SaveFilter &operator=(const SaveFilter &other);
68 
69  std::vector<mitk::MimeType> GetMimeTypes() const;
70  QString GetFilterForMimeType(const std::string &mimeType) const;
71  mitk::MimeType GetMimeTypeForFilter(const QString &filter) const;
72  QString GetDefaultFilter() const;
73  QString GetDefaultExtension() const;
74  mitk::MimeType GetDefaultMimeType() const;
75  QString ToString() const;
76  int Size() const;
77  bool IsEmpty() const;
78 
79  bool ContainsMimeType(const std::string &mimeType);
80 
81  private:
82  struct Impl;
83  QScopedPointer<Impl> d;
84  };
85 
90  static QString GetFileOpenFilterString();
91 
105  static QList<mitk::BaseData::Pointer> Load(const QStringList &paths, QWidget *parent = NULL);
106 
107  static mitk::DataStorage::SetOfObjects::Pointer Load(const QStringList &paths,
108  mitk::DataStorage &storage,
109  QWidget *parent = NULL);
110 
111  static QList<mitk::BaseData::Pointer> Load(const QString &path, QWidget *parent = NULL);
112 
113  static mitk::DataStorage::SetOfObjects::Pointer Load(const QString &path,
114  mitk::DataStorage &storage,
115  QWidget *parent = NULL);
116 
117  using mitk::IOUtil::Load;
118 
119  static QString Save(const mitk::BaseData *data,
120  const QString &defaultBaseName,
121  const QString &defaultPath = QString(),
122  QWidget *parent = NULL);
123 
182  static QStringList Save(const std::vector<const mitk::BaseData *> &data,
183  const QStringList &defaultBaseNames,
184  const QString &defaultPath = QString(),
185  QWidget *parent = NULL);
186 
187  using mitk::IOUtil::Save;
188 
197  DEPRECATED(static void SaveBaseDataWithDialog(mitk::BaseData *data, std::string fileName, QWidget *parent = NULL));
198 
207  DEPRECATED(static void SaveSurfaceWithDialog(mitk::Surface::Pointer surface,
208  std::string fileName = "",
209  QWidget *parent = NULL));
210 
219  DEPRECATED(static void SaveImageWithDialog(mitk::Image::Pointer image,
220  std::string fileName = "",
221  QWidget *parent = NULL));
222 
231  DEPRECATED(static void SavePointSetWithDialog(mitk::PointSet::Pointer pointset,
232  std::string fileName = "",
233  QWidget *parent = NULL));
234 
235 private:
236  struct Impl;
237 };
238 
239 #endif // _QmitkIOUtil__h_
static void Save(const mitk::BaseData *data, const std::string &path)
Save a mitk::BaseData instance.
Definition: mitkIOUtil.cpp:824
Data management class that handles 'was created by' relations.
itk::SmartPointer< Self > Pointer
Base of all data objects.
Definition: mitkBaseData.h:39
DataCollection - Class to facilitate loading/accessing structured data.
#define MITKQTWIDGETS_EXPORT
QmitkIOUtil Provides static helper methods to open and save files with Qt dialogs.
Definition: QmitkIOUtil.h:55
#define DEPRECATED(func)
Definition: mitkCommon.h:183
A utility class to load and save data from/to the local file system.
Definition: mitkIOUtil.h:50
The MimeType class represens a registered mime-type. It is an immutable wrapper for mitk::CustomMimeT...
Definition: mitkMimeType.h:45
static DataStorage::SetOfObjects::Pointer Load(const std::string &path, DataStorage &storage)
Load a file into the given DataStorage.
Definition: mitkIOUtil.cpp:483