Medical Imaging Interaction Toolkit
2016.11.0
Medical Imaging Interaction Toolkit
|
Base class for creating mitk::BaseData objects from files or streams. More...
#include <mitkAbstractFileReader.h>
Classes | |
class | InputStream |
An input stream wrapper. More... | |
Public Member Functions | |
virtual void | SetInput (const std::string &location) override |
Set the input location. More... | |
virtual void | SetInput (const std::string &location, std::istream *is) override |
Set an input stream to read from. More... | |
virtual std::string | GetInputLocation () const override |
Get the current input location. More... | |
virtual std::istream * | GetInputStream () const override |
Get the input stream. More... | |
MimeType | GetRegisteredMimeType () const |
virtual std::vector< itk::SmartPointer< BaseData > > | Read () override=0 |
Reads a path or stream and creates a list of BaseData objects. More... | |
virtual DataStorage::SetOfObjects::Pointer | Read (mitk::DataStorage &ds) override |
Reads the specified file or input stream, loading its contents into the provided DataStorage. More... | |
virtual ConfidenceLevel | GetConfidenceLevel () const override |
The confidence level of the reader or writer implementation. More... | |
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< IFileReader > | RegisterService (us::ModuleContext *context=us::GetModuleContext()) |
void | UnregisterService () |
Public Member Functions inherited from mitk::IFileReader | |
virtual | ~IFileReader () |
Public Member Functions inherited from mitk::IFileIO | |
virtual | ~IFileIO () |
Protected Member Functions | |
AbstractFileReader () | |
~AbstractFileReader () | |
AbstractFileReader (const AbstractFileReader &other) | |
AbstractFileReader (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) |
std::string | GetDescription () const |
void | SetDefaultOptions (const Options &defaultOptions) |
Options | GetDefaultOptions () const |
void | SetRanking (int ranking) |
Set the service ranking for this file reader. More... | |
int | GetRanking () const |
std::string | GetLocalFileName () const |
Get a local file name for reading. More... | |
virtual void | SetDefaultDataNodeProperties (DataNode *node, const std::string &filePath) |
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::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 creating mitk::BaseData objects from files or streams.
Definition at line 46 of file mitkAbstractFileReader.h.
|
protected |
Definition at line 64 of file mitkAbstractFileReader.cpp.
|
protected |
Definition at line 65 of file mitkAbstractFileReader.cpp.
References UnregisterService().
|
protected |
Definition at line 77 of file mitkAbstractFileReader.cpp.
|
explicitprotected |
Associate this reader instance with the given MIME type.
If mimeType
does not provide an extension list, an already registered mime-type object is used. Otherwise, the first entry in the extensions list is used to construct a mime-type name and register it as a new CustomMimeType service object in the default implementation of RegisterMimeType().
mimeType | The mime type this reader can read. |
description | A human readable description of this reader. |
std::invalid_argument | if mimeType is empty. |
Definition at line 81 of file mitkAbstractFileReader.cpp.
|
overridevirtual |
Implements mitk::IFileIO.
Definition at line 273 of file mitkAbstractFileReader.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::AbstractFileIOReader.
Definition at line 120 of file mitkAbstractFileReader.cpp.
References GetInputLocation(), mitk::IFileIO::Supported, and mitk::IFileIO::Unsupported.
Referenced by mitk::AbstractFileIOReader::GetReaderConfidenceLevel().
|
protected |
Definition at line 246 of file mitkAbstractFileReader.cpp.
Referenced by mitk::AbstractFileIO::GetDefaultReaderOptions().
|
protected |
Definition at line 284 of file mitkAbstractFileReader.cpp.
Referenced by mitk::AbstractFileIO::GetReaderDescription(), and GetServiceProperties().
|
overridevirtual |
Get the current input location.
Implements mitk::IFileReader.
Definition at line 264 of file mitkAbstractFileReader.cpp.
Referenced by GetConfidenceLevel(), GetLocalFileName(), mitk::RandomForestFileIO::GetReaderConfidenceLevel(), mitk::DiffusionImageNiftiReaderService::InternalRead(), mitk::DiffusionImageNrrdReaderService::InternalRead(), mitk::ImageVtkXmlIO::Read(), mitk::SurfaceVtkXmlIO::Read(), mitk::DummyLsetFileReader::Read(), mitk::ExampleDataStructureReaderService::Read(), mitk::ConnectomicsNetworkReader::Read(), mitk::NrrdQBallImageReader::Read(), mitk::NrrdTensorImageReader::Read(), mitk::RTDoseReader::Read(), and Read().
|
overridevirtual |
Get the input stream.
Implements mitk::IFileReader.
Definition at line 265 of file mitkAbstractFileReader.cpp.
Referenced by mitk::ImageVtkXmlIO::GetReaderConfidenceLevel(), mitk::SurfaceVtkXmlIO::GetReaderConfidenceLevel(), mitk::ImageVtkXmlIO::Read(), and mitk::SurfaceVtkXmlIO::Read().
|
protected |
Get a local file name for reading.
This is a convenience method for readers which cannot work natively with input streams. If no input stream has been been set, this method just returns the result of GetLocation(). However, if SetLocation(std::string, std::istream*) has been called with a non-null input stream, this method writes the contents of the stream to a temporary file and returns the name of the temporary file.
The temporary file is deleted when either SetLocation(std::string, std::istream*) is called again with a different input stream or the destructor of this class is called.
This method does not validate file names set via SetInput(std::string).
Definition at line 212 of file mitkAbstractFileReader.cpp.
References mitk::IOUtil::CreateTemporaryFile(), and GetInputLocation().
Referenced by mitk::ImageVtkLegacyIO::GetReaderConfidenceLevel(), mitk::SurfaceVtkLegacyIO::GetReaderConfidenceLevel(), mitk::MAPRegistrationWrapperIO::GetReaderConfidenceLevel(), mitk::RandomForestFileIO::GetReaderConfidenceLevel(), mitk::ItkImageIO::GetReaderConfidenceLevel(), mitk::LabelSetImageIO::GetReaderConfidenceLevel(), mitk::BaseDICOMReaderService::GetRelevantFiles(), mitk::DicomSeriesReaderService::Read(), mitk::ImageVtkLegacyIO::Read(), mitk::SurfaceStlIO::Read(), mitk::SurfaceVtkLegacyIO::Read(), mitk::MAPRegistrationWrapperIO::Read(), mitk::BaseDICOMReaderService::Read(), mitk::ItkImageIO::Read(), mitk::LabelSetImageIO::Read(), and mitk::MAPRegistrationWrapperIO::Write().
|
protected |
Definition at line 281 of file mitkAbstractFileReader.cpp.
Referenced by mitk::AbstractFileIO::GetMimeType(), GetServiceProperties(), mitk::DiffusionImageNiftiReaderService::InternalRead(), mitk::DiffusionImageNrrdReaderService::InternalRead(), and RegisterService().
|
protected |
Definition at line 283 of file mitkAbstractFileReader.cpp.
|
overridevirtual |
Implements mitk::IFileIO.
Definition at line 268 of file mitkAbstractFileReader.cpp.
Referenced by mitk::AbstractFileIO::GetReaderOption().
|
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 267 of file mitkAbstractFileReader.cpp.
Referenced by mitk::AbstractFileIO::GetReaderOptions().
|
protected |
Definition at line 211 of file mitkAbstractFileReader.cpp.
Referenced by mitk::AbstractFileIO::GetReaderRanking(), and GetServiceProperties().
MimeType mitk::AbstractFileReader::GetRegisteredMimeType | ( | ) | const |
Definition at line 266 of file mitkAbstractFileReader.cpp.
Referenced by mitk::AbstractFileIO::RegisterService(), and SetDefaultDataNodeProperties().
|
protectedvirtual |
Definition at line 193 of file mitkAbstractFileReader.cpp.
References GetDescription(), GetMimeType(), mitk::CustomMimeType::GetName(), GetRanking(), mitk::IFileIO::PROP_DESCRIPTION(), mitk::IFileIO::PROP_MIMETYPE(), and us::ServiceConstants::SERVICE_RANKING().
Referenced by RegisterService().
|
overridepure virtual |
Reads a path or stream and creates a list of BaseData objects.
This method must be implemented for each specific reader. Call GetInputStream() first and check for a non-null stream to read from. If the input stream is NULL
, use GetInputLocation() to read from a local file-system path.
If the reader cannot use streams directly, use GetLocalFileName() instead.
mitk::Exception |
Implements mitk::IFileReader.
Implemented in mitk::RTDoseReader, mitk::GeometryDataReaderService, mitk::PointSetReaderService, mitk::DiffusionImageNiftiReaderService, mitk::DiffusionImageNrrdReaderService, mitk::NrrdTensorImageReader, mitk::ContourModelSetReader, mitk::ContourModelReader, mitk::NrrdQBallImageReader, mitk::LabelSetImageIO, mitk::ItkImageIO, mitk::ConnectomicsNetworkReader, mitk::FiberBundleTrackVisReader, mitk::FiberBundleVtkReader, mitk::PlanarFigureCompositeReader, mitk::TubeGraphIO, mitk::RandomForestFileIO, mitk::RawImageFileReaderService, mitk::ExampleDataStructureReaderService, mitk::NavigationDataReaderCSV, mitk::NavigationDataReaderXML, mitk::DummyLsetFileReader, mitk::BaseDICOMReaderService, mitk::MAPRegistrationWrapperIO, mitk::LegacyFileReaderService, mitk::SurfaceVtkLegacyIO, mitk::SurfaceVtkXmlIO, mitk::ImageVtkLegacyIO, mitk::ImageVtkXmlIO, mitk::SurfaceStlIO, mitk::SimulationIO, and mitk::DicomSeriesReaderService.
Definition at line 89 of file mitkAbstractFileReader.cpp.
References mitk::StandaloneDataStorage::New().
Referenced by Read().
|
overridevirtual |
Reads the specified file or input stream, loading its contents into the provided DataStorage.
ds | The DataStorage to which the data is added. |
ds
.This method may be overridden by implementations to create or reconstructed a hierarchy of mitk::DataNode instances in the provided mitk::DataStorage.
mitk::Exception |
Implements mitk::IFileReader.
Definition at line 105 of file mitkAbstractFileReader.cpp.
References mitk::DataStorage::Add(), GetInputLocation(), mitk::New(), mitk::DataNode::New(), Read(), and SetDefaultDataNodeProperties().
|
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 203 of file mitkAbstractFileReader.cpp.
us::ServiceRegistration< IFileReader > mitk::AbstractFileReader::RegisterService | ( | us::ModuleContext * | context = us::GetModuleContext() | ) |
Associate this reader with the MIME type returned by the current IMimeTypeProvider service for the provided extension if the MIME type exists, otherwise registers a new MIME type when RegisterService() is called.
If no MIME type for extension
is already registered, a call to RegisterService() will register a new MIME type and associate this reader instance with it. The MIME type id can be set via SetMimeType() or it will be auto-generated using extension
, having the form "application/vnd.mitk.<extension>".
extension | The file extension (without a leading period) for which a registered mime-type object is looked up and associated with this reader instance. |
description | A human readable description of this reader. |
Definition at line 139 of file mitkAbstractFileReader.cpp.
References GetMimeType(), us::GetModuleContext(), GetName(), GetServiceProperties(), and MITK_WARN.
Referenced by mitk::AutoSelectingDICOMReaderService::AutoSelectingDICOMReaderService(), mitk::ClassicDICOMSeriesReaderService::ClassicDICOMSeriesReaderService(), mitk::ConnectomicsNetworkReader::ConnectomicsNetworkReader(), mitk::ContourModelReader::ContourModelReader(), mitk::ContourModelSetReader::ContourModelSetReader(), mitk::DicomSeriesReaderService::DicomSeriesReaderService(), mitk::DiffusionImageNiftiReaderService::DiffusionImageNiftiReaderService(), mitk::DiffusionImageNrrdReaderService::DiffusionImageNrrdReaderService(), mitk::ExampleDataStructureReaderService::ExampleDataStructureReaderService(), mitk::FiberBundleTrackVisReader::FiberBundleTrackVisReader(), mitk::FiberBundleVtkReader::FiberBundleVtkReader(), mitk::GeometryDataReaderService::GeometryDataReaderService(), mitk::LegacyFileReaderService::LegacyFileReaderService(), mitk::NavigationDataReaderCSV::NavigationDataReaderCSV(), mitk::NavigationDataReaderXML::NavigationDataReaderXML(), mitk::NrrdQBallImageReader::NrrdQBallImageReader(), mitk::NrrdTensorImageReader::NrrdTensorImageReader(), mitk::PlanarFigureCompositeReader::PlanarFigureCompositeReader(), mitk::PointSetReaderService::PointSetReaderService(), mitk::RawImageFileReaderService::RawImageFileReaderService(), mitk::AbstractFileIO::RegisterService(), and mitk::RTDoseReader::RTDoseReader().
|
overridevirtual |
Implements mitk::IFileIO.
Definition at line 274 of file mitkAbstractFileReader.cpp.
|
protectedvirtual |
Definition at line 285 of file mitkAbstractFileReader.cpp.
References mitk::DataNode::GetData(), mitk::DataNode::GetProperty(), mitk::BaseData::GetProperty(), GetRegisteredMimeType(), mitk::StringProperty::New(), mitk::StringProperty::PATH, mitk::DataNode::SetProperty(), and mitk::DataNode::SetVisibility().
Referenced by Read().
|
protected |
Definition at line 241 of file mitkAbstractFileReader.cpp.
Referenced by mitk::RawImageFileReaderService::RawImageFileReaderService(), and mitk::AbstractFileIO::SetDefaultReaderOptions().
|
protected |
Definition at line 209 of file mitkAbstractFileReader.cpp.
Referenced by mitk::ContourModelReader::ContourModelReader(), mitk::ContourModelSetReader::ContourModelSetReader(), mitk::LegacyFileReaderService::LegacyFileReaderService(), mitk::MAPRegistrationWrapperIO::MAPRegistrationWrapperIO(), and mitk::AbstractFileIO::SetReaderDescription().
|
overridevirtual |
Set the input location.
location | The file name to read from. |
Implements mitk::IFileReader.
Definition at line 247 of file mitkAbstractFileReader.cpp.
Referenced by mitk::ContourModelSetReader::Read().
|
overridevirtual |
Set an input stream to read from.
location | A custom label for the input stream. |
is | The 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
.
Implements mitk::IFileReader.
Definition at line 253 of file mitkAbstractFileReader.cpp.
|
protected |
Definition at line 208 of file mitkAbstractFileReader.cpp.
Referenced by mitk::ContourModelReader::ContourModelReader(), mitk::ContourModelSetReader::ContourModelSetReader(), mitk::ItkImageIO::ItkImageIO(), mitk::LegacyFileReaderService::LegacyFileReaderService(), mitk::MAPRegistrationWrapperIO::MAPRegistrationWrapperIO(), mitk::RandomForestFileIO::RandomForestFileIO(), and mitk::AbstractFileIO::SetMimeType().
|
protected |
Definition at line 282 of file mitkAbstractFileReader.cpp.
Referenced by mitk::ItkImageIO::ItkImageIO(), mitk::LegacyFileReaderService::LegacyFileReaderService(), and mitk::RandomForestFileIO::RandomForestFileIO().
|
overridevirtual |
Implements mitk::IFileIO.
Definition at line 270 of file mitkAbstractFileReader.cpp.
Referenced by mitk::AbstractFileIO::SetReaderOption().
|
overridevirtual |
Implements mitk::IFileIO.
Definition at line 269 of file mitkAbstractFileReader.cpp.
Referenced by mitk::AbstractFileIO::SetReaderOptions().
|
protected |
Set the service ranking for this file reader.
Default is zero and should only be chosen differently for a reason. The ranking is used to determine which reader to use if several equivalent readers have been found. It may be used to replace a default reader from MITK in your own project. E.g. if you want to use your own reader for nrrd files instead of the default, implement it and give it a higher ranking than zero.
Definition at line 210 of file mitkAbstractFileReader.cpp.
Referenced by mitk::ItkImageIO::ItkImageIO(), mitk::LabelSetImageIO::LabelSetImageIO(), and mitk::AbstractFileIO::SetReaderRanking().
void mitk::AbstractFileReader::UnregisterService | ( | ) |
Definition at line 182 of file mitkAbstractFileReader.cpp.
Referenced by ~AbstractFileReader().