Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkFileWriterSelector.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 mitkFileWriterSelector_h
14 #define mitkFileWriterSelector_h
15 
16 #include <mitkIFileWriter.h>
17 
18 #include <mitkMimeType.h>
19 
20 #include <usServiceReference.h>
21 
22 #include <string>
23 #include <vector>
24 
25 namespace mitk
26 {
27  class BaseData;
28 
46  {
47  public:
56  {
57  public:
62  Item(const Item &other);
63 
64  ~Item();
65 
71  Item &operator=(const Item &other);
72 
78 
83  std::string GetDescription() const;
84 
90 
96 
101  std::string GetBaseDataType() const;
102 
108 
113  long GetServiceId() const;
114 
123  bool operator<(const Item &other) const;
124 
125  private:
126  friend class FileWriterSelector;
127 
128  Item();
129 
130  struct Impl;
132  };
133 
139 
150  FileWriterSelector(const BaseData *baseData,
151  const std::string &destMimeType = std::string(),
152  const std::string &path = std::string());
153 
155 
162 
167  bool IsEmpty() const;
168 
182  std::vector<Item> Get(const std::string &mimeType) const;
183 
188  std::vector<Item> Get() const;
189 
195  Item Get(long id) const;
196 
201  Item GetDefault() const;
202 
207  long GetDefaultId() const;
208 
213  Item GetSelected() const;
214 
219  long GetSelectedId() const;
220 
226  bool Select(const std::string &mimeType);
227 
233  bool Select(const Item &item);
234 
240  bool Select(long id);
241 
246  std::vector<MimeType> GetMimeTypes() const;
247 
253 
254  private:
255  struct Impl;
257  };
258 
265 }
266 
267 #endif
#define MITKCORE_EXPORT
Base class of all data objects.
Definition: mitkBaseData.h:60
Represents a single candidate file writer with associated metadata.
long GetServiceId() const
Get the service id for this writer.
Item & operator=(const Item &other)
Copy assignment operator.
MimeType GetMimeType() const
Get the mime-type associated with this writer item.
std::string GetDescription() const
Get the human-readable description of this writer.
bool operator<(const Item &other) const
Compare two items for sorting.
IFileWriter::ConfidenceLevel GetConfidenceLevel() const
Get the confidence level of this writer for the given data.
IFileWriter * GetWriter() const
Get the IFileWriter instance for this item.
us::ServiceReference< IFileWriter > GetReference() const
Get the service reference for this writer.
Item(const Item &other)
Copy constructor.
std::string GetBaseDataType() const
Get the BaseData type name this writer supports.
Selects the most suitable IFileWriter for a given BaseData object.
void Swap(FileWriterSelector &fws)
Swap the contents of this selector with another.
Item GetSelected() const
Get the currently selected writer item.
std::vector< Item > Get() const
Get a sorted list of writer items matching the currently selected mime-type.
long GetSelectedId() const
Get the service id of the currently selected writer.
bool Select(const std::string &mimeType)
Select the best writer for the given mime-type.
FileWriterSelector(const BaseData *baseData, const std::string &destMimeType=std::string(), const std::string &path=std::string())
Construct a selector for the given BaseData and optional mime-type/path.
Item Get(long id) const
Get a writer item by its service id.
std::vector< Item > Get(const std::string &mimeType) const
Get a sorted list of writer items filtered by mime-type.
bool IsEmpty() const
Check whether any suitable writers were found.
bool Select(const Item &item)
Select a writer by Item.
Item GetDefault() const
Get the best-matching (highest-ranked) writer item.
FileWriterSelector(const FileWriterSelector &other)
Copy constructor.
FileWriterSelector & operator=(const FileWriterSelector &other)
Copy assignment operator.
std::vector< MimeType > GetMimeTypes() const
Get all mime-types for which at least one writer was found.
bool Select(long id)
Select a writer by its service id.
long GetDefaultId() const
Get the service id of the best-matching writer.
Immutable, value-type wrapper for a registered mime-type.
Definition: mitkMimeType.h:45
Find image slices visible on a given plane.
void swap(CustomMimeType &l, CustomMimeType &r)
Swap two CustomMimeType objects.
ConfidenceLevel
A confidence level describing the reader's or writer's ability to handle the given data or file forma...
Definition: mitkIFileIO.h:57
The common interface of all MITK file writers.