#include <mlFileReaderPluginsBase.h>
Base class for a generic file reader plugin with factory interface. Classes deriving from FileReaderPluginsBase must implement all pure virtual functions and register themselves in the Runtime type system normally with ML_CLASS_HEADER(DerivedClassName), ML_CLASS_SOURCE(DerivedClassName, FileReaderPluginsBase), and the corresponding DerivedClassName::initClass() call during library load. It is recommended to load the library with a .def file entry such as
PreloadDLL DerivedPluginClassLibrary {}
to make MeVisLab load the class library on startup time to ensure that classes using the createLoaderInstance() functionality surely can find it.
Definition at line 32 of file mlFileReaderPluginsBase.h.
◆ FileReaderPluginsBase()
| ml::FileReaderPluginsBase::FileReaderPluginsBase |
( |
| ) |
|
◆ ~FileReaderPluginsBase()
| virtual ml::FileReaderPluginsBase::~FileReaderPluginsBase |
( |
| ) |
|
|
virtual |
Destructor cleaning up allocated structures and closing a possibly open file.
◆ _determineWorldDifferenceAsVoxelShift()
| ImageVector ml::FileReaderPluginsBase::_determineWorldDifferenceAsVoxelShift |
( |
const PagedImage & | destination | ) |
const |
|
protected |
◆ close()
| virtual void ml::FileReaderPluginsBase::close |
( |
| ) |
|
|
pure virtual |
◆ createLoaderInstance()
Factory functionality: Instantiate a loader for the file name fileName and return a new instance of it or return nullptr if no loader can be created.
References FileReaderPluginsBase().
◆ extractImageIndexValue()
| virtual unsigned int ml::FileReaderPluginsBase::extractImageIndexValue |
( |
const std::string & | codedLoaderPluginString | ) |
|
|
virtual |
From a string of the format "LoaderPluginName+#IDX" extract "IDX" as unsigned int, check whether it is smaller than the number of images in getNumberOfImagesInFile() and if yes then return it. If the "*#" code does not exist it is assumed that the index is not coded and 0 is returned. If "*#" is found but the index cannot be parsed after it or if it outside the number of images in the file then ML_UINT32_MAX is returned.
◆ fillSubImage()
Copy overlapping regions in dstSubImage with image data from the loaded file; note that the calculation of the overlapping region depends on whether a PagedImage was set with setReferenceForFillingInReferenceCoordinates or not. Loaders which do not support filling in reference coordinates (which return false on supportsFillingInReferenceCoordinates()) will silently ignore the reference image.
- Parameters
-
| dstSubImage | The subimage to be filled with data from the loaded file where the image regions overlap. Non overlapping regions are left unchanged. |
- Returns
- ML_RESULT_OK on success or an error or a descriptive code explaining the error. On error free operation and empty overlapping region also ML_RESULT_OK is returned.
Implemented in ml::DMFileReaderPlugin, and ml::XYLibReaderPlugin.
◆ getCodedImageIndexString()
| virtual std::string ml::FileReaderPluginsBase::getCodedImageIndexString |
( |
unsigned int | imgIdx | ) |
|
|
virtual |
If getNumberOfImagesInFile() is <=1 then the plugin string id getTypeId()->getName() is returned, otherwise the string getTypeId()->getName() plus "*#" and the imgIdx. In case of invalid getTypeId()->getName() "Unknown" is coded as plugin id.
◆ getNumberOfImagesInFile()
| virtual size_t ml::FileReaderPluginsBase::getNumberOfImagesInFile |
( |
| ) |
|
|
pure virtual |
◆ getPagedImageProperties()
| virtual const PagedImage & ml::FileReaderPluginsBase::getPagedImageProperties |
( |
| ) |
|
|
pure virtual |
◆ getPluginPriority()
| virtual double ml::FileReaderPluginsBase::getPluginPriority |
( |
| ) |
const |
|
virtual |
Returns a priority over other loader plugins, low priorities mean that other loader plugins with higher priorities which can also read the file should be preferred if there are any. The order of plugins with equal priorities is left undefined. The returned value defaults to 0.5; values should be from [0,1].
Reimplemented in ml::XYLibReaderPlugin.
◆ getReferenceForFillingInReferenceCoordinates()
| virtual const PagedImage * ml::FileReaderPluginsBase::getReferenceForFillingInReferenceCoordinates |
( |
| ) |
const |
|
virtual |
Returns the recently set "enabled" state set with setSubImageFillingInReferenceCoordinates().
◆ getSelectedImageIndex()
| virtual size_t ml::FileReaderPluginsBase::getSelectedImageIndex |
( |
| ) |
const |
|
virtual |
Returns the currently selected image from inside the loaded file.
◆ getTagDump()
| virtual std::string ml::FileReaderPluginsBase::getTagDump |
( |
const size_t | maxNumBinaryEntries = 8, |
|
|
const size_t | maxNumStringEntries = 20 ) |
|
virtual |
This function returns a tag or meta data dump of the loaded file or an empty string if not possible (default implementation). If a binary value information is displayed then the number of shown values is controlled with maxNumBinaryEntries; if there are more then "..." is displayed instead. If a string value is displayed then the number of shown characters is controlled with maxNumStringEntries; if there are more then "..." is displayed instead.
Reimplemented in ml::DMFileReaderPlugin, and ml::XYLibReaderPlugin.
◆ isSupported()
| virtual bool ml::FileReaderPluginsBase::isSupported |
( |
const std::string & | fileName | ) |
const |
|
pure virtual |
Applies a fast check whether the file is probably supported or not, for
example via the suffix. If false is returned then file is definitely not loadable; if true then opening with loadFile() is worth a try.
Implemented in ml::DMFileReaderPlugin, and ml::XYLibReaderPlugin.
◆ loadFile()
| virtual MLErrorCode ml::FileReaderPluginsBase::loadFile |
( |
const std::string & | fileName | ) |
|
|
pure virtual |
◆ setReferenceForFillingInReferenceCoordinates()
| virtual void ml::FileReaderPluginsBase::setReferenceForFillingInReferenceCoordinates |
( |
const PagedImage * | refImg = nullptr | ) |
|
|
virtual |
If a valid PagedImage pointer is passed then each fillSubImage operation will take into account the difference between the world origin of the given reference PagedImage and ensure that the copySubImage operation fills dstSubImg in world coordinates of refImg; if nullptr is passed then subimage data will be copied from the file assuming that it is located at voxel coordinates (0,0,0,0,0,0) Loaders which do not support world coordinates will silently ignore the given reference image.
- Parameters
-
| refImg | The image providing the reference coordinate system; it's life time must be longer than the last fillSubImage operation. If it is not valid or the matrix is not of rank 4 then operations
will be the same as with refImg = nullptr. |
◆ setSelectedImageIndex()
| virtual void ml::FileReaderPluginsBase::setSelectedImageIndex |
( |
size_t | idx = 0 | ) |
|
|
virtual |
Selects which image from inside the loaded file shall be used. Typically 0, but some formats can load more than one image from a file whose number can be determined with getNumberOfImagesInFile().
◆ supportsFillingInReferenceCoordinates()
| virtual bool ml::FileReaderPluginsBase::supportsFillingInReferenceCoordinates |
( |
| ) |
const |
|
virtual |
The documentation for this class was generated from the following file: