Medical Imaging Interaction Toolkit  2018.4.99-6ca56567
Medical Imaging Interaction Toolkit
mitk::IFileReader Struct Referenceabstract

The common interface for all MITK file readers. More...

#include <mitkIFileReader.h>

Inheritance diagram for mitk::IFileReader:
Collaboration diagram for mitk::IFileReader:

Public Member Functions

 ~IFileReader () override
 
virtual void SetInput (const std::string &location)=0
 Set the input location. More...
 
virtual void SetInput (const std::string &location, std::istream *is)=0
 Set an input stream to read from. More...
 
virtual std::string GetInputLocation () const =0
 Get the current input location. More...
 
virtual std::istream * GetInputStream () const =0
 Get the input stream. More...
 
virtual std::vector< itk::SmartPointer< BaseData > > Read ()=0
 Reads the specified file or input stream and returns its contents. More...
 
virtual DataStorage::SetOfObjects::Pointer Read (mitk::DataStorage &ds)=0
 Reads the specified file or input stream, loading its contents into the provided DataStorage. More...
 
virtual std::vector< std::string > GetReadFiles ()=0
 
virtual ~IFileReader ()
 
virtual void SetInput (const std::string &location)=0
 Set the input location. More...
 
virtual void SetInput (const std::string &location, std::istream *is)=0
 Set an input stream to read from. More...
 
virtual std::string GetInputLocation () const =0
 Get the current input location. More...
 
virtual std::istream * GetInputStream () const =0
 Get the input stream. More...
 
virtual std::vector< itk::SmartPointer< BaseData > > Read ()=0
 Reads the specified file or input stream and returns its contents. More...
 
virtual DataStorage::SetOfObjects::Pointer Read (mitk::DataStorage &ds)=0
 Reads the specified file or input stream, loading its contents into the provided DataStorage. More...
 
- Public Member Functions inherited from mitk::IFileIO
virtual ~IFileIO ()
 
virtual ConfidenceLevel GetConfidenceLevel () const =0
 The confidence level of the reader or writer implementation. More...
 
virtual Options GetOptions () const =0
 returns a list of the supported options More...
 
virtual us::Any GetOption (const std::string &name) const =0
 
virtual void SetOptions (const Options &options)=0
 
virtual void SetOption (const std::string &name, const us::Any &value)=0
 
virtual void AddProgressCallback (const ProgressCallback &callback)=0
 
virtual void RemoveProgressCallback (const ProgressCallback &callback)=0
 

Additional Inherited Members

- Public Types inherited from mitk::IFileIO
enum  ConfidenceLevel { Unsupported, PartiallySupported, Supported }
 A confidence level describing the confidence of the reader or writer in handling the given data. More...
 
typedef std::map< std::string, us::AnyOptions
 Options for reading or writing data. More...
 
typedef mitk::MessageAbstractDelegate1< float > ProgressCallback
 
- Static Public Member Functions inherited from mitk::IFileIO
static std::string PROP_DESCRIPTION ()
 Service property name for a description. More...
 
static std::string PROP_MIMETYPE ()
 Service property name for the mime-type associated with this file writer. More...
 

Detailed Description

The common interface for all MITK file readers.

The common interface for all providers of models for fitting in mitk.

Implementations of this interface must be registered as a service to make themselve available via the service registry. If the implementation is state-full, the service should be registered using a PrototypeServiceFactory.

The file reader implementation is associated with a mime-type, specified in the service property PROP_MIMETYPE(). The specified mime-type should have a corresponding CustomMimeType service object, registered by the reader or some other party.

It is recommended to derive new implementations from AbstractFileReader or from AbstractFileIO (if both reader and writer is implemented), which provide correct service registration semantics.

See also
AbstractFileReader
AbstractFileIO
CustomMimeType
FileReaderRegistry
IFileWriter

Implementations of this interface must be registered as a service to make themselve available via the service registry. If the implementation is state-full, the service should be registered using a PrototypeServiceFactory.

It is recommended to derive new implementations from ModelFitProviderBase, which provide correct service registration semantics.

See also
ModelFitProviderBase

Definition at line 60 of file mitkIFileReader.h.

Constructor & Destructor Documentation

◆ ~IFileReader() [1/2]

mitk::IFileReader::~IFileReader ( )
override

Definition at line 17 of file mitkIFileReader.cpp.

◆ ~IFileReader() [2/2]

virtual mitk::IFileReader::~IFileReader ( )
virtual

Member Function Documentation

◆ GetInputLocation() [1/2]

virtual std::string mitk::IFileReader::GetInputLocation ( ) const
pure virtual

Get the current input location.

Returns
The input location.

Implemented in mitk::AbstractFileReader.

◆ GetInputLocation() [2/2]

virtual std::string mitk::IFileReader::GetInputLocation ( ) const
pure virtual

Get the current input location.

Returns
The input location.

Implemented in mitk::AbstractFileReader.

Referenced by mitk::AbstractFileReader::InputStream::InputStream().

◆ GetInputStream() [1/2]

virtual std::istream* mitk::IFileReader::GetInputStream ( ) const
pure virtual

Get the input stream.

Returns
The currently set input stream.

Implemented in mitk::AbstractFileReader.

◆ GetInputStream() [2/2]

virtual std::istream* mitk::IFileReader::GetInputStream ( ) const
pure virtual

Get the input stream.

Returns
The currently set input stream.

Implemented in mitk::AbstractFileReader.

Referenced by mitk::AbstractFileReader::InputStream::InputStream().

◆ GetReadFiles()

virtual std::vector< std::string > mitk::IFileReader::GetReadFiles ( )
pure virtual
Returns
A list of files that were loaded during the last call of Read.

Implemented in mitk::AbstractFileReader.

Referenced by mitk::IOUtil::Load().

◆ Read() [1/4]

virtual std::vector<itk::SmartPointer<BaseData> > mitk::IFileReader::Read ( )
pure virtual

Reads the specified file or input stream and returns its contents.

Returns
A list of created BaseData objects.

If GetInputStream() returns a non-null value, this method must use the returned stream object to read the data from. If no input stream was set, the data must be read from the path returned by GetInputLocation().

Exceptions
mitk::Exception

Implemented in mitk::AbstractFileReader, mitk::CESTDICOMReaderService, and mitk::CESTDICOMManualReaderService.

◆ Read() [2/4]

virtual std::vector<itk::SmartPointer<BaseData> > mitk::IFileReader::Read ( )
pure virtual

Reads the specified file or input stream and returns its contents.

Returns
A list of created BaseData objects.

If GetInputStream() returns a non-null value, this method must use the returned stream object to read the data from. If no input stream was set, the data must be read from the path returned by GetInputLocation().

Exceptions
mitk::Exception

Implemented in mitk::AbstractFileReader, mitk::CESTDICOMReaderService, and mitk::CESTDICOMManualReaderService.

Referenced by mitk::IOUtil::Load(), and mitkPointSetReaderTest().

◆ Read() [3/4]

virtual DataStorage::SetOfObjects::Pointer mitk::IFileReader::Read ( mitk::DataStorage ds)
pure virtual

Reads the specified file or input stream, loading its contents into the provided DataStorage.

Parameters
dsThe DataStorage to which the data is added.
Returns
The set of added DataNodes to ds.

This method may be overridden by implementations to create or reconstructed a hierarchy of mitk::DataNode instances in the provided mitk::DataStorage.

Exceptions
mitk::Exception

Implemented in mitk::AbstractFileReader.

◆ Read() [4/4]

virtual DataStorage::SetOfObjects::Pointer mitk::IFileReader::Read ( mitk::DataStorage ds)
pure virtual

Reads the specified file or input stream, loading its contents into the provided DataStorage.

Parameters
dsThe DataStorage to which the data is added.
Returns
The set of added DataNodes to ds.

This method may be overridden by implementations to create or reconstructed a hierarchy of mitk::DataNode instances in the provided mitk::DataStorage.

Exceptions
mitk::Exception

Implemented in mitk::AbstractFileReader.

◆ SetInput() [1/4]

virtual void mitk::IFileReader::SetInput ( const std::string &  location)
pure virtual

Set the input location.

Parameters
locationThe file name to read from.

Implemented in mitk::AbstractFileReader.

◆ SetInput() [2/4]

virtual void mitk::IFileReader::SetInput ( const std::string &  location,
std::istream *  is 
)
pure virtual

Set an input stream to read from.

Parameters
locationA custom label for the input stream.
isThe input stream.

If is is NULL, this clears the current input stream and location is interpreted as a file-system path. Otherwise, location is a custom label describing the input stream is.

Implemented in mitk::AbstractFileReader.

◆ SetInput() [3/4]

virtual void mitk::IFileReader::SetInput ( const std::string &  location)
pure virtual

Set the input location.

Parameters
locationThe file name to read from.

Implemented in mitk::AbstractFileReader.

Referenced by mitk::FileReaderSelector::FileReaderSelector(), mitk::IOUtil::Load(), and mitkPointSetReaderTest().

◆ SetInput() [4/4]

virtual void mitk::IFileReader::SetInput ( const std::string &  location,
std::istream *  is 
)
pure virtual

Set an input stream to read from.

Parameters
locationA custom label for the input stream.
isThe input stream.

If is is nullptr, this clears the current input stream and location is interpreted as a file-system path. Otherwise, location is a custom label describing the input stream is.

Implemented in mitk::AbstractFileReader.


The documentation for this struct was generated from the following files: