Medical Imaging Interaction Toolkit
2016.11.0
Medical Imaging Interaction Toolkit
|
Base class for writing mitk::BaseData objects to files or streams. More...
#include <mitkAbstractFileWriter.h>
Classes | |
class | LocalFile |
A local file representation for streams. More... | |
class | OutputStream |
An output stream wrapper. More... | |
Public Member Functions | |
virtual void | SetInput (const BaseData *data) override |
Set the input data for writing. More... | |
virtual const BaseData * | GetInput () const override |
Get the input data set via SetInput(). More... | |
virtual void | SetOutputLocation (const std::string &location) override |
Set the output location. More... | |
virtual std::string | GetOutputLocation () const override |
Get the current output location. More... | |
virtual void | SetOutputStream (const std::string &location, std::ostream *os) override |
Set an output stream for writing. More... | |
virtual std::ostream * | GetOutputStream () const override |
Get the output stream. More... | |
virtual void | Write () override=0 |
Write the base data to the specified location or output stream. More... | |
virtual ConfidenceLevel | GetConfidenceLevel () const override |
The confidence level of the reader or writer implementation. More... | |
MimeType | GetRegisteredMimeType () const |
virtual Options | GetOptions () const override |
returns a list of the supported options More... | |
virtual us::Any | GetOption (const std::string &name) const override |
virtual void | SetOptions (const Options &options) override |
virtual void | SetOption (const std::string &name, const us::Any &value) override |
virtual void | AddProgressCallback (const ProgressCallback &callback) override |
virtual void | RemoveProgressCallback (const ProgressCallback &callback) override |
us::ServiceRegistration< IFileWriter > | RegisterService (us::ModuleContext *context=us::GetModuleContext()) |
void | UnregisterService () |
Public Member Functions inherited from mitk::IFileWriter | |
virtual | ~IFileWriter () |
Public Member Functions inherited from mitk::IFileIO | |
virtual | ~IFileIO () |
Protected Member Functions | |
~AbstractFileWriter () | |
AbstractFileWriter (const AbstractFileWriter &other) | |
AbstractFileWriter (const std::string &baseDataType) | |
AbstractFileWriter (const std::string &baseDataType, const CustomMimeType &mimeType, const std::string &description) | |
virtual us::ServiceProperties | GetServiceProperties () const |
virtual us::ServiceRegistration< CustomMimeType > | RegisterMimeType (us::ModuleContext *context) |
void | SetMimeType (const CustomMimeType &mimeType) |
const CustomMimeType * | GetMimeType () const |
void | SetMimeTypePrefix (const std::string &prefix) |
std::string | GetMimeTypePrefix () const |
void | SetDescription (const std::string &description) |
Sets a human readable description of this writer. More... | |
std::string | GetDescription () const |
void | SetDefaultOptions (const Options &defaultOptions) |
Options | GetDefaultOptions () const |
void | SetRanking (int ranking) |
Set the service ranking for this file writer. More... | |
int | GetRanking () const |
void | SetBaseDataType (const std::string &baseDataType) |
Sets the name of the mitk::Basedata that this writer is able to handle. More... | |
virtual std::string | GetBaseDataType () const |
void | ValidateOutputLocation () const |
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::Any > | Options |
Options for reading or writing data. More... | |
typedef mitk::MessageAbstractDelegate1< float > | ProgressCallback |
Static Public Member Functions inherited from mitk::IFileWriter | |
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... | |
Base class for writing mitk::BaseData objects to files or streams.
In general, all file writers should derive from this class, this way it is made sure that the new implementation is exposed to the Microservice-Framework and that is automatically available troughout MITK. The default implementation only requires one Write() method and the Clone() method to be implemented.
Definition at line 54 of file mitkAbstractFileWriter.h.
|
protected |
Definition at line 129 of file mitkAbstractFileWriter.cpp.
References UnregisterService().
|
protected |
Definition at line 136 of file mitkAbstractFileWriter.cpp.
|
protected |
Definition at line 140 of file mitkAbstractFileWriter.cpp.
|
protected |
Definition at line 145 of file mitkAbstractFileWriter.cpp.
|
overridevirtual |
Implements mitk::IFileIO.
Definition at line 266 of file mitkAbstractFileWriter.cpp.
|
protectedvirtual |
Definition at line 277 of file mitkAbstractFileWriter.cpp.
|
overridevirtual |
The confidence level of the reader or writer implementation.
The level is used to rank multiple competing implementations.
Implements mitk::IFileIO.
Reimplemented in mitk::AbstractFileIOWriter, mitk::ConnectomicsNetworkMatrixWriter, mitk::ConnectomicsNetworkCSVWriter, mitk::NrrdQBallImageWriter, mitk::NrrdTensorImageWriter, mitk::DiffusionImageNiftiWriterService, mitk::DiffusionImageNrrdWriterService, and mitk::LegacyFileWriterService.
Definition at line 157 of file mitkAbstractFileWriter.cpp.
References mitk::IFileIO::Supported, and mitk::IFileIO::Unsupported.
Referenced by mitk::LegacyFileWriterService::GetConfidenceLevel(), mitk::ConnectomicsNetworkCSVWriter::GetConfidenceLevel(), mitk::ConnectomicsNetworkMatrixWriter::GetConfidenceLevel(), and mitk::AbstractFileIOWriter::GetWriterConfidenceLevel().
|
protected |
Definition at line 259 of file mitkAbstractFileWriter.cpp.
Referenced by mitk::AbstractFileIO::GetDefaultWriterOptions().
|
protected |
Definition at line 276 of file mitkAbstractFileWriter.cpp.
Referenced by GetServiceProperties(), and mitk::AbstractFileIO::GetWriterDescription().
|
overridevirtual |
Get the input data set via SetInput().
Implements mitk::IFileWriter.
Definition at line 114 of file mitkAbstractFileWriter.cpp.
Referenced by mitk::SurfaceVtkIO::GetPolyData(), mitk::ImageVtkXmlIO::GetWriterConfidenceLevel(), mitk::ImageVtkLegacyIO::GetWriterConfidenceLevel(), mitk::MAPRegistrationWrapperIO::GetWriterConfidenceLevel(), mitk::SurfaceVtkIO::GetWriterConfidenceLevel(), mitk::ItkImageIO::GetWriterConfidenceLevel(), mitk::LabelSetImageIO::GetWriterConfidenceLevel(), mitk::SurfaceStlIO::Write(), mitk::ImageVtkLegacyIO::Write(), mitk::ImageVtkXmlIO::Write(), mitk::SurfaceVtkLegacyIO::Write(), mitk::SurfaceVtkXmlIO::Write(), mitk::MAPRegistrationWrapperIO::Write(), mitk::TubeGraphIO::Write(), mitk::ItkImageIO::Write(), and mitk::LabelSetImageIO::Write().
|
protected |
Definition at line 242 of file mitkAbstractFileWriter.cpp.
Referenced by mitk::AbstractFileIO::GetMimeType(), GetServiceProperties(), mitk::AbstractFileIO::RegisterService(), and RegisterService().
|
protected |
Definition at line 244 of file mitkAbstractFileWriter.cpp.
|
overridevirtual |
Implements mitk::IFileIO.
Definition at line 261 of file mitkAbstractFileWriter.cpp.
Referenced by mitk::AbstractFileIO::GetWriterOption().
|
overridevirtual |
returns a list of the supported options
Options are strings that are treated as flags when passed to the write method.
Implements mitk::IFileIO.
Definition at line 260 of file mitkAbstractFileWriter.cpp.
Referenced by mitk::AbstractFileIO::GetWriterOptions().
|
overridevirtual |
Get the current output location.
If no stream is set (i.e. GetOutputStream returns NULL
), the returned location string is required to represent a file-system path.
Implements mitk::IFileWriter.
Definition at line 121 of file mitkAbstractFileWriter.cpp.
Referenced by mitk::SurfaceVtkIO::GetPolyData(), ValidateOutputLocation(), mitk::ImageVtkXmlIO::Write(), and mitk::MAPRegistrationWrapperIO::Write().
|
overridevirtual |
Get the output stream.
Implements mitk::IFileWriter.
Definition at line 128 of file mitkAbstractFileWriter.cpp.
Referenced by ValidateOutputLocation(), mitk::SurfaceStlIO::Write(), mitk::ImageVtkXmlIO::Write(), mitk::SurfaceVtkLegacyIO::Write(), mitk::SurfaceVtkXmlIO::Write(), and mitk::MAPRegistrationWrapperIO::Write().
|
protected |
Definition at line 274 of file mitkAbstractFileWriter.cpp.
Referenced by GetServiceProperties(), and mitk::AbstractFileIO::GetWriterRanking().
MimeType mitk::AbstractFileWriter::GetRegisteredMimeType | ( | ) | const |
Definition at line 170 of file mitkAbstractFileWriter.cpp.
|
protectedvirtual |
Definition at line 227 of file mitkAbstractFileWriter.cpp.
References GetDescription(), GetMimeType(), mitk::CustomMimeType::GetName(), GetRanking(), mitk::IFileWriter::PROP_BASEDATA_TYPE(), mitk::IFileIO::PROP_DESCRIPTION(), mitk::IFileIO::PROP_MIMETYPE(), and us::ServiceConstants::SERVICE_RANKING().
Referenced by RegisterService().
|
protectedvirtual |
Registers a new CustomMimeType service object.
This method is called from RegisterService and the default implementation registers a new mime-type service object if all of the following conditions are true:
context |
std::invalid_argument | if context is NULL. |
Definition at line 245 of file mitkAbstractFileWriter.cpp.
us::ServiceRegistration< IFileWriter > mitk::AbstractFileWriter::RegisterService | ( | us::ModuleContext * | context = us::GetModuleContext() | ) |
Definition at line 173 of file mitkAbstractFileWriter.cpp.
References GetMimeType(), us::GetModuleContext(), GetName(), GetServiceProperties(), and MITK_WARN.
Referenced by mitk::ConnectomicsNetworkCSVWriter::ConnectomicsNetworkCSVWriter(), mitk::ConnectomicsNetworkMatrixWriter::ConnectomicsNetworkMatrixWriter(), mitk::ConnectomicsNetworkWriter::ConnectomicsNetworkWriter(), mitk::ContourModelSetWriter::ContourModelSetWriter(), mitk::ContourModelWriter::ContourModelWriter(), mitk::DiffusionImageNiftiWriterService::DiffusionImageNiftiWriterService(), mitk::DiffusionImageNrrdWriterService::DiffusionImageNrrdWriterService(), mitk::ExampleDataStructureWriterService::ExampleDataStructureWriterService(), mitk::FiberBundleTrackVisWriter::FiberBundleTrackVisWriter(), mitk::FiberBundleVtkWriter::FiberBundleVtkWriter(), mitk::GeometryDataWriterService::GeometryDataWriterService(), mitk::LegacyFileWriterService::LegacyFileWriterService(), mitk::NavigationDataSetWriterCSV::NavigationDataSetWriterCSV(), mitk::NavigationDataSetWriterXML::NavigationDataSetWriterXML(), mitk::NrrdQBallImageWriter::NrrdQBallImageWriter(), mitk::NrrdTensorImageWriter::NrrdTensorImageWriter(), mitk::PlanarFigureCompositeWriter::PlanarFigureCompositeWriter(), mitk::PointSetWriterService::PointSetWriterService(), and mitk::AbstractFileIO::RegisterService().
|
overridevirtual |
Implements mitk::IFileIO.
Definition at line 267 of file mitkAbstractFileWriter.cpp.
|
protected |
Sets the name of the mitk::Basedata that this writer is able to handle.
The correct value is the one given as the first parameter in the mitkNewMacro of that BaseData derivate. You can also retrieve it by calling GetNameOfClass()
on an instance of said data.
Definition at line 275 of file mitkAbstractFileWriter.cpp.
|
protected |
Definition at line 254 of file mitkAbstractFileWriter.cpp.
Referenced by mitk::FiberBundleVtkWriter::FiberBundleVtkWriter(), and mitk::AbstractFileIO::SetDefaultWriterOptions().
|
protected |
Sets a human readable description of this writer.
This will be used in file dialogs for example.
Definition at line 291 of file mitkAbstractFileWriter.cpp.
Referenced by mitk::ContourModelSetWriter::ContourModelSetWriter(), mitk::ContourModelWriter::ContourModelWriter(), mitk::LegacyFileWriterService::LegacyFileWriterService(), mitk::MAPRegistrationWrapperIO::MAPRegistrationWrapperIO(), and mitk::AbstractFileIO::SetWriterDescription().
|
overridevirtual |
Set the input data for writing.
data | The input data. |
Implements mitk::IFileWriter.
Definition at line 113 of file mitkAbstractFileWriter.cpp.
Referenced by mitk::ContourModelSetSerializer::Serialize(), mitk::ContourModelSerializer::Serialize(), mitk::QBallImageSerializer::Serialize(), mitk::ConnectomicsNetworkSerializer::Serialize(), mitk::TensorImageSerializer::Serialize(), and mitk::ContourModelSetWriter::Write().
|
protected |
Definition at line 250 of file mitkAbstractFileWriter.cpp.
Referenced by mitk::ContourModelSetWriter::ContourModelSetWriter(), mitk::ContourModelWriter::ContourModelWriter(), mitk::ItkImageIO::ItkImageIO(), mitk::LegacyFileWriterService::LegacyFileWriterService(), mitk::MAPRegistrationWrapperIO::MAPRegistrationWrapperIO(), mitk::RandomForestFileIO::RandomForestFileIO(), mitk::AbstractFileIO::RegisterService(), and mitk::AbstractFileIO::SetMimeType().
|
protected |
Definition at line 243 of file mitkAbstractFileWriter.cpp.
Referenced by mitk::LegacyFileWriterService::LegacyFileWriterService(), and mitk::RandomForestFileIO::RandomForestFileIO().
|
overridevirtual |
Implements mitk::IFileIO.
Definition at line 262 of file mitkAbstractFileWriter.cpp.
Referenced by mitk::AbstractFileIO::SetWriterOption().
|
overridevirtual |
Implements mitk::IFileIO.
Definition at line 263 of file mitkAbstractFileWriter.cpp.
Referenced by mitk::AbstractFileIO::SetWriterOptions().
|
overridevirtual |
Set the output location.
location | A 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.
Implements mitk::IFileWriter.
Definition at line 115 of file mitkAbstractFileWriter.cpp.
Referenced by mitk::ContourModelSetSerializer::Serialize(), mitk::ContourModelSerializer::Serialize(), mitk::QBallImageSerializer::Serialize(), mitk::ConnectomicsNetworkSerializer::Serialize(), mitk::TensorImageSerializer::Serialize(), and mitk::MAPRegistrationWrapperSerializer::Serialize().
|
overridevirtual |
Set an output stream for writing.
location | A custom label for the output stream. |
os | The output stream. |
If os
is NULL
, 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
.
Implements mitk::IFileWriter.
Definition at line 122 of file mitkAbstractFileWriter.cpp.
Referenced by mitk::ContourModelSetWriter::Write().
|
protected |
Set the service ranking for this file writer.
Default is zero and should only be chosen differently for a reason. The ranking is used to determine which writer to use if several equivalent writers have been found. It may be used to replace a default writer from MITK in your own project. E.g. if you want to use your own writer for nrrd files instead of the default, implement it and give it a higher ranking than zero.
Definition at line 251 of file mitkAbstractFileWriter.cpp.
Referenced by mitk::ItkImageIO::ItkImageIO(), mitk::LabelSetImageIO::LabelSetImageIO(), and mitk::AbstractFileIO::SetWriterRanking().
void mitk::AbstractFileWriter::UnregisterService | ( | ) |
Definition at line 216 of file mitkAbstractFileWriter.cpp.
Referenced by ~AbstractFileWriter().
|
protected |
Definition at line 278 of file mitkAbstractFileWriter.cpp.
References GetOutputLocation(), GetOutputStream(), and mitkThrow.
Referenced by mitk::SurfaceStlIO::Write(), mitk::ImageVtkLegacyIO::Write(), mitk::ImageVtkXmlIO::Write(), mitk::SurfaceVtkLegacyIO::Write(), mitk::SurfaceVtkXmlIO::Write(), and mitk::LabelSetImageIO::Write().
|
overridepure virtual |
Write the base data to the specified location or output stream.
This method must be implemented for each specific writer. Call GetOutputStream() first and check for a non-null stream to write to. If the output stream is NULL
, use GetOutputLocation() to write to a local file-system path.
If the reader cannot use streams directly, use GetLocalFile() to retrieve a temporary local file name instead.
mitk::Exception |
Implements mitk::IFileWriter.
Implemented in mitk::ContourModelWriter, mitk::LabelSetImageIO, mitk::GeometryDataWriterService, mitk::ItkImageIO, mitk::TubeGraphIO, mitk::PointSetWriterService, mitk::ConnectomicsNetworkMatrixWriter, mitk::ConnectomicsNetworkCSVWriter, mitk::ConnectomicsNetworkWriter, mitk::FiberBundleTrackVisWriter, mitk::FiberBundleVtkWriter, mitk::MAPRegistrationWrapperIO, mitk::NrrdQBallImageWriter, mitk::NrrdTensorImageWriter, mitk::ContourModelSetWriter, mitk::SurfaceVtkLegacyIO, mitk::SurfaceVtkXmlIO, mitk::PlanarFigureCompositeWriter, mitk::RandomForestFileIO, mitk::ExampleDataStructureWriterService, mitk::ImageVtkLegacyIO, mitk::ImageVtkXmlIO, mitk::DiffusionImageNiftiWriterService, mitk::DiffusionImageNrrdWriterService, mitk::SurfaceStlIO, mitk::LegacyFileWriterService, mitk::SimulationIO, mitk::NavigationDataSetWriterXML, and mitk::NavigationDataSetWriterCSV.