Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
Medical Imaging Interaction Toolkit
mitk::IFileWriter Struct Referenceabstract

The common interface of all MITK file writers. More...

#include <mitkIFileWriter.h>

Inheritance diagram for mitk::IFileWriter:
Collaboration diagram for mitk::IFileWriter:

Public Member Functions

 ~IFileWriter () override
 
virtual void SetInput (const BaseData *data)=0
 Set the input data for writing. More...
 
virtual const BaseDataGetInput () const =0
 Get the input data set via SetInput(). More...
 
virtual void SetOutputLocation (const std::string &location)=0
 Set the output location. More...
 
virtual std::string GetOutputLocation () const =0
 Get the current output location. More...
 
virtual void SetOutputStream (const std::string &location, std::ostream *os)=0
 Set an output stream for writing. More...
 
virtual std::ostream * GetOutputStream () const =0
 Get the output stream. More...
 
virtual void Write ()=0
 Write the input data. 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
 

Static Public Member Functions

static std::string PROP_BASEDATA_TYPE ()
 Service property name for the supported mitk::BaseData sub-class. More...
 
- 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...
 

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
 

Detailed Description

The common interface of all MITK file writers.

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

The file writer implementation is associated with a mime-type, specified in the service property PROP_MIMETYPE() and a mitk::BaseData sub-class as specified in the PROP_BASEDATA_TYPE() service property. 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 AbstractFileWriter or AbstractFileIO (if both reader and writer is implemented), which provide correct service registration semantics.

A more in-depth explanation is available on the concepts pages in the developer manual.

See also
AbstractFileWriter
AbstractFileIO
CustomMimeType
FileWriterRegistry
IFileReader

Definition at line 56 of file mitkIFileWriter.h.

Constructor & Destructor Documentation

◆ ~IFileWriter()

mitk::IFileWriter::~IFileWriter ( )
override

Member Function Documentation

◆ GetInput()

virtual const BaseData* mitk::IFileWriter::GetInput ( ) const
pure virtual

Get the input data set via SetInput().

Returns
The input data.

Implemented in mitk::AbstractFileWriter.

◆ GetOutputLocation()

virtual std::string mitk::IFileWriter::GetOutputLocation ( ) const
pure virtual

Get the current output location.

Returns
The output location.

If no stream is set (i.e. GetOutputStream returns nullptr), the returned location string is required to represent a file-system path.

Implemented in mitk::AbstractFileWriter.

◆ GetOutputStream()

virtual std::ostream* mitk::IFileWriter::GetOutputStream ( ) const
pure virtual

Get the output stream.

Returns
The currently set output stream.

Implemented in mitk::AbstractFileWriter.

◆ PROP_BASEDATA_TYPE()

static std::string mitk::IFileWriter::PROP_BASEDATA_TYPE ( )
static

Service property name for the supported mitk::BaseData sub-class.

The property value must be of type std::string.

Returns
The property name.

◆ SetInput()

virtual void mitk::IFileWriter::SetInput ( const BaseData data)
pure virtual

Set the input data for writing.

Parameters
dataThe input data.

Implemented in mitk::AbstractFileWriter.

◆ SetOutputLocation()

virtual void mitk::IFileWriter::SetOutputLocation ( const std::string &  location)
pure virtual

Set the output location.

Parameters
locationA file-system path.

The location argument specifies a file-system path where the input data must be written. This method must remove any previously set output stream.

Implemented in mitk::AbstractFileWriter.

◆ SetOutputStream()

virtual void mitk::IFileWriter::SetOutputStream ( const std::string &  location,
std::ostream *  os 
)
pure virtual

Set an output stream for writing.

Parameters
locationA custom label for the output stream.
osThe output stream.

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

Implemented in mitk::AbstractFileWriter.

◆ Write()


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