Medical Imaging Interaction Toolkit  2023.12.00
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 
180  static QStringList Save(const std::vector<const mitk::BaseData *> &data,
181  const QStringList &defaultBaseNames,
182  const QString &defaultPath = QString(),
183  QWidget *parent = nullptr,
184  bool setPathProperty = false);
185 
186  using mitk::IOUtil::Save;
187 
196  DEPRECATED(static void SaveBaseDataWithDialog(mitk::BaseData *data, std::string fileName, QWidget *parent = nullptr));
197 
206  DEPRECATED(static void SaveSurfaceWithDialog(mitk::Surface::Pointer surface,
207  std::string fileName = "",
208  QWidget *parent = nullptr));
209 
218  DEPRECATED(static void SaveImageWithDialog(mitk::Image::Pointer image,
219  std::string fileName = "",
220  QWidget *parent = nullptr));
221 
230  DEPRECATED(static void SavePointSetWithDialog(mitk::PointSet::Pointer pointset,
231  std::string fileName = "",
232  QWidget *parent = nullptr));
233 
234 private:
235  struct Impl;
236 };
237 
238 #endif
MITKQTWIDGETS_EXPORT
#define MITKQTWIDGETS_EXPORT
Definition: MitkQtWidgetsExports.h:15
mitkImage.h
DEPRECATED
#define DEPRECATED(func)
Definition: mitkCommon.h:175
itk::SmartPointer< Self >
mitkPointSet.h
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitkSurface.h
mitk::IOUtil::SaveInfo
Definition: mitkIOUtil.h:78
QmitkIOUtil
QmitkIOUtil Provides static helper methods to open and save files with Qt dialogs.
Definition: QmitkIOUtil.h:51
MitkQtWidgetsExports.h
mitkCommon.h
mitkFileWriterWithInformation.h
mitk::BaseData
Base of all data objects.
Definition: mitkBaseData.h:42
mitk::DataStorage
Data management class that handles 'was created by' relations.
Definition: mitkDataStorage.h:43
mitkDataNode.h
QmitkIOUtil::SaveFilter
Definition: QmitkIOUtil.h:54
mitkBaseData.h
mitk::IOUtil::Save
static void Save(const mitk::BaseData *data, const std::string &path, bool setPathProperty=false)
Save a mitk::BaseData instance.
mitkIOUtil.h
mitk::IOUtil::Load
static DataStorage::SetOfObjects::Pointer Load(const std::string &path, DataStorage &storage, const ReaderOptionsFunctorBase *optionsCallback=nullptr)
Load a file into the given DataStorage.
mitk::IOUtil
A utility class to load and save data from/to the local file system.
Definition: mitkIOUtil.h:49
mitk::MimeType
The MimeType class represens a registered mime-type. It is an immutable wrapper for mitk::CustomMimeT...
Definition: mitkMimeType.h:36