Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
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 
40 namespace mitk
41 {
42  class DataStorage;
43  class MimeType;
44  struct IFileReader;
45 }
46 
51 {
52 public:
54  {
55  public:
56  static mitk::MimeType ALL_MIMETYPE();
57 
58  SaveFilter(const SaveFilter &other);
59 
60  SaveFilter(const SaveInfo &saveInfo);
61 
62  SaveFilter &operator=(const SaveFilter &other);
63 
64  std::vector<mitk::MimeType> GetMimeTypes() const;
65  QString GetFilterForMimeType(const std::string &mimeType) const;
66  mitk::MimeType GetMimeTypeForFilter(const QString &filter) const;
67  QString GetDefaultFilter() const;
68  QString GetDefaultExtension() const;
69  mitk::MimeType GetDefaultMimeType() const;
70  QString ToString() const;
71  int Size() const;
72  bool IsEmpty() const;
73 
74  bool ContainsMimeType(const std::string &mimeType);
75 
76  private:
77  struct Impl;
78  QScopedPointer<Impl> d;
79  };
80 
85  static QString GetFileOpenFilterString();
86 
100  static QList<mitk::BaseData::Pointer> Load(const QStringList &paths, QWidget *parent = nullptr);
101 
102  static mitk::DataStorage::SetOfObjects::Pointer Load(const QStringList &paths,
103  mitk::DataStorage &storage,
104  QWidget *parent = nullptr);
105 
106  static QList<mitk::BaseData::Pointer> Load(const QString &path, QWidget *parent = nullptr);
107 
108  static mitk::DataStorage::SetOfObjects::Pointer Load(const QString &path,
109  mitk::DataStorage &storage,
110  QWidget *parent = nullptr);
111 
112  using mitk::IOUtil::Load;
113 
114  static QString Save(const mitk::BaseData *data,
115  const QString &defaultBaseName,
116  const QString &defaultPath = QString(),
117  QWidget *parent = nullptr,
118  bool setPathProperty = false);
119 
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
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:50
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:53
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 represents a registered mime-type. It is an immutable wrapper for mitk::CustomMime...
Definition: mitkMimeType.h:36