Medical Imaging Interaction Toolkit  2018.4.99-f51274ea
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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef _QmitkIOUtil__h_
14 #define _QmitkIOUtil__h_
15 
16 #include "MitkQtWidgetsExports.h"
17 
18 // std
19 #include <string>
20 
21 // mitk includes
22 #include <mitkBaseData.h>
23 #include <mitkCommon.h>
24 #include <mitkDataNode.h>
26 #include <mitkIOUtil.h>
27 #include <mitkImage.h>
28 #include <mitkPointSet.h>
29 #include <mitkSurface.h>
30 
31 // Qt
32 #include <QList>
33 #include <QPair>
34 #include <QScopedPointer>
35 #include <QString>
36 
37 class QWidget;
38 class QString;
39 class QStringList;
40 
41 namespace mitk
42 {
43  class DataStorage;
44  class MimeType;
45  struct IFileReader;
46 }
47 
52 {
53 public:
55  {
56  public:
57  static mitk::MimeType ALL_MIMETYPE();
58 
59  SaveFilter(const SaveFilter &other);
60 
61  SaveFilter(const SaveInfo &saveInfo);
62 
63  SaveFilter &operator=(const SaveFilter &other);
64 
65  std::vector<mitk::MimeType> GetMimeTypes() const;
66  QString GetFilterForMimeType(const std::string &mimeType) const;
67  mitk::MimeType GetMimeTypeForFilter(const QString &filter) const;
68  QString GetDefaultFilter() const;
69  QString GetDefaultExtension() const;
70  mitk::MimeType GetDefaultMimeType() const;
71  QString ToString() const;
72  int Size() const;
73  bool IsEmpty() const;
74 
75  bool ContainsMimeType(const std::string &mimeType);
76 
77  private:
78  struct Impl;
79  QScopedPointer<Impl> d;
80  };
81 
86  static QString GetFileOpenFilterString();
87 
101  static QList<mitk::BaseData::Pointer> Load(const QStringList &paths, QWidget *parent = nullptr);
102 
103  static mitk::DataStorage::SetOfObjects::Pointer Load(const QStringList &paths,
104  mitk::DataStorage &storage,
105  QWidget *parent = nullptr);
106 
107  static QList<mitk::BaseData::Pointer> Load(const QString &path, QWidget *parent = nullptr);
108 
109  static mitk::DataStorage::SetOfObjects::Pointer Load(const QString &path,
110  mitk::DataStorage &storage,
111  QWidget *parent = nullptr);
112 
113  using mitk::IOUtil::Load;
114 
115  static QString Save(const mitk::BaseData *data,
116  const QString &defaultBaseName,
117  const QString &defaultPath = QString(),
118  QWidget *parent = nullptr,
119  bool setPathProperty = false);
120 
179  static QStringList Save(const std::vector<const mitk::BaseData *> &data,
180  const QStringList &defaultBaseNames,
181  const QString &defaultPath = QString(),
182  QWidget *parent = nullptr,
183  bool setPathProperty = false);
184 
185  using mitk::IOUtil::Save;
186 
195  DEPRECATED(static void SaveBaseDataWithDialog(mitk::BaseData *data, std::string fileName, QWidget *parent = nullptr));
196 
205  DEPRECATED(static void SaveSurfaceWithDialog(mitk::Surface::Pointer surface,
206  std::string fileName = "",
207  QWidget *parent = nullptr));
208 
217  DEPRECATED(static void SaveImageWithDialog(mitk::Image::Pointer image,
218  std::string fileName = "",
219  QWidget *parent = nullptr));
220 
229  DEPRECATED(static void SavePointSetWithDialog(mitk::PointSet::Pointer pointset,
230  std::string fileName = "",
231  QWidget *parent = nullptr));
232 
233 private:
234  struct Impl;
235 };
236 
237 #endif // _QmitkIOUtil__h_
Data management class that handles &#39;was created by&#39; relations.
Base of all data objects.
Definition: mitkBaseData.h:42
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:51
#define DEPRECATED(func)
Definition: mitkCommon.h:179
A utility class to load and save data from/to the local file system.
Definition: mitkIOUtil.h:43
mitk::Image::Pointer image
The MimeType class represens a registered mime-type. It is an immutable wrapper for mitk::CustomMimeT...
Definition: mitkMimeType.h:36
static void Save(const mitk::BaseData *data, const std::string &path, bool setPathProperty=false)
Save a mitk::BaseData instance.
Definition: mitkIOUtil.cpp:774
static DataStorage::SetOfObjects::Pointer Load(const std::string &path, DataStorage &storage, const ReaderOptionsFunctorBase *optionsCallback=nullptr)
Load a file into the given DataStorage.
Definition: mitkIOUtil.cpp:489