13 #ifndef mitkAbstractFileReader_h
14 #define mitkAbstractFileReader_h
60 void SetInput(
const std::string &location)
override;
67 void SetInput(
const std::string &location, std::istream *is)
override;
97 std::vector<itk::SmartPointer<BaseData>>
Read()
override;
210 std::istream *m_Stream;
258 virtual std::vector<itk::SmartPointer<BaseData>>
DoRead() = 0;
384 std::unique_ptr<Impl> d;
Base class for creating mitk::BaseData objects from files or streams.
std::vector< std::string > m_ReadFiles
List of files consumed during the last Read() call. Must be filled by DoRead().
void SetMimeType(const CustomMimeType &mimeType)
Set the MIME type this reader can handle.
AbstractFileReader(const AbstractFileReader &other)
Copy constructor.
std::vector< std::string > GetReadFiles() override
Get the list of files consumed during the last Read() call.
void SetOption(const std::string &name, const us::Any &value) override
Set a single option value.
void SetProperties(const PropertyList *properties) override
Set base data properties as a source of meta data for reading.
ConfidenceLevel GetConfidenceLevel() const override
Determine confidence for reading the current input.
std::istream * GetInputStream() const override
Get the current input stream.
Options GetOptions() const override
Get the current option values.
std::string GetInputLocation() const override
Get the current input location.
void AddProgressCallback(const ProgressCallback &callback) override
Register a progress callback.
MimeType GetRegisteredMimeType() const
Get the mime-type that was registered for this reader.
virtual us::ServiceRegistration< CustomMimeType > RegisterMimeType(us::ModuleContext *context)
Register a new CustomMimeType service object.
us::ServiceRegistration< IFileReader > RegisterService(us::ModuleContext *context=us::GetModuleContext())
Register this reader as a CppMicroServices service.
const PropertyList * GetProperties() const override
Get the properties set via SetProperties().
virtual us::ServiceProperties GetServiceProperties() const
Get the service properties for registration.
void SetInput(const std::string &location) override
Set the input file path, clearing any previously set input stream.
const CustomMimeType * GetMimeType() const
Get the MIME type this reader can handle.
void RemoveProgressCallback(const ProgressCallback &callback) override
Remove a previously registered progress callback.
us::Any GetOption(const std::string &name) const override
Get the value of a specific option.
std::string GetMimeTypePrefix() const
Get the current MIME type name prefix.
~AbstractFileReader() override
virtual std::vector< itk::SmartPointer< BaseData > > DoRead()=0
Perform the actual reading operation.
AbstractFileReader()
Default constructor.
std::vector< itk::SmartPointer< BaseData > > Read() override
Read data and create a list of BaseData objects.
Options GetDefaultOptions() const
Get the default options for this reader.
virtual void SetDefaultDataNodeProperties(DataNode *node, const std::string &filePath)
Set default properties on a DataNode after reading.
void SetMimeTypePrefix(const std::string &prefix)
Set the prefix used for auto-generated MIME type names.
void SetRanking(int ranking)
Set the service ranking for this file reader.
void UnregisterService()
Unregister this reader from the CppMicroServices registry.
std::string GetLocalFileName() const
Get a local file name for reading.
AbstractFileReader(const CustomMimeType &mimeType, const std::string &description)
Associate this reader instance with the given MIME type.
std::string GetDescription() const
Get the human-readable description of this reader.
void SetDefaultOptions(const Options &defaultOptions)
Set the default options for this reader.
DataStorage::SetOfObjects::Pointer Read(mitk::DataStorage &ds) override
Read data and add it to the given DataStorage.
void SetOptions(const Options &options) override
Set multiple options at once.
void SetDescription(const std::string &description)
Set the human-readable description of this reader.
int GetRanking() const
Get the service ranking for this file reader.
void SetInput(const std::string &location, std::istream *is) override
Set an input stream and associated location label.
A custom mime-type that can be registered as a service object.
Central node class of the MITK data tree, associating a data object with properties and mappers.
Abstract data management class that organizes DataNode objects in a directed acyclic graph.
Abstract base class for message delegates with one parameter.
Immutable, value-type wrapper for a registered mime-type.
Key-value list holding instances of BaseProperty.
An Any class represents a general type and is capable of storing any type, supporting type-safe extra...
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
std::unordered_map< std::string, Any > ServiceProperties
Find image slices visible on a given plane.
ConfidenceLevel
A confidence level describing the reader's or writer's ability to handle the given data or file forma...
std::map< std::string, us::Any > Options
Options for reading or writing data.
The common interface for all MITK file readers.
A factory for prototype scope services. The factory can provide multiple, unique service objects.