Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkFileReaderSelector.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 mitkFileReaderSelector_h
14 #define mitkFileReaderSelector_h
15 
16 #include <mitkIFileReader.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:
55  {
56  public:
61  Item(const Item &other);
62 
63  ~Item();
64 
70  Item &operator=(const Item &other);
71 
77 
82  std::string GetDescription() const;
83 
89 
95 
101 
106  long GetServiceId() const;
107 
116  bool operator<(const Item &other) const;
117 
118  private:
119  friend class FileReaderSelector;
120 
121  Item();
122 
123  struct Impl;
125  };
126 
132 
141  FileReaderSelector(const std::string &path);
142 
144 
151 
156  bool IsEmpty() const;
157 
162  std::vector<MimeType> GetMimeTypes() const;
163 
176  std::vector<Item> Get() const;
177 
183  Item Get(long id) const;
184 
189  Item GetDefault() const;
190 
195  long GetDefaultId() const;
196 
201  Item GetSelected() const;
202 
207  long GetSelectedId() const;
208 
214  bool Select(const Item &item);
215 
221  bool Select(long id);
222 
228 
229  private:
230  struct Impl;
232  };
233 
240 }
241 
242 #endif
#define MITKCORE_EXPORT
Represents a single candidate file reader with associated metadata.
IFileReader * GetReader() const
Get the IFileReader instance for this item.
Item & operator=(const Item &other)
Copy assignment operator.
us::ServiceReference< IFileReader > GetReference() const
Get the service reference for this reader.
MimeType GetMimeType() const
Get the mime-type associated with this reader item.
bool operator<(const Item &other) const
Compare two items for sorting.
Item(const Item &other)
Copy constructor.
std::string GetDescription() const
Get the human-readable description of this reader.
long GetServiceId() const
Get the service id for this reader.
IFileReader::ConfidenceLevel GetConfidenceLevel() const
Get the confidence level of this reader for the given file.
Selects the most suitable IFileReader for a given file path.
void Swap(FileReaderSelector &fws)
Swap the contents of this selector with another.
bool Select(const Item &item)
Select a reader by Item.
std::vector< Item > Get() const
Get a sorted list of all file reader items.
std::vector< MimeType > GetMimeTypes() const
Get all mime-types that matched the file path.
Item GetDefault() const
Get the best-matching (highest-ranked) reader item.
long GetDefaultId() const
Get the service id of the best-matching reader.
bool IsEmpty() const
Check whether any suitable readers were found.
long GetSelectedId() const
Get the service id of the currently selected reader.
FileReaderSelector(const std::string &path)
Construct a selector for the given file path.
FileReaderSelector & operator=(const FileReaderSelector &other)
Copy assignment operator.
Item GetSelected() const
Get the currently selected reader item.
Item Get(long id) const
Get a reader item by its service id.
bool Select(long id)
Select a reader by its service id.
FileReaderSelector(const FileReaderSelector &other)
Copy constructor.
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 for all MITK file readers.