MeVisLab Toolbox Reference
mlFileReaderPluginsBase.h
Go to the documentation of this file.
1 // Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2 // **InsertLicense** code
3 //----------------------------------------------------------------------------------
5 
10 //----------------------------------------------------------------------------------
11 
12 #pragma once
13 
15 #include <mlModuleIncludes.h>
16 
17 ML_START_NAMESPACE
18 
33 
34 public:
35 
38  static FileReaderPluginsBase* createLoaderInstance(const std::string &fileName);
39 
42 
45 
49  virtual bool isSupported(const std::string& fileName) const = 0;
50 
55  virtual double getPluginPriority() const;
56 
63  virtual MLErrorCode loadFile(const std::string& fileName) = 0;
64 
67  virtual size_t getNumberOfImagesInFile() = 0;
68 
72  virtual std::string getCodedImageIndexString(unsigned int imgIdx);
73 
82  virtual unsigned int extractImageIndexValue(const std::string& codedLoaderPluginString);
83 
87  virtual void setSelectedImageIndex(size_t idx = 0);
88 
90  virtual size_t getSelectedImageIndex() const;
91 
94  virtual const PagedImage &getPagedImageProperties() = 0;
95 
108  virtual MLErrorCode fillSubImage(SubImage &dstSubImage) = 0;
109 
118  virtual std::string getTagDump(const size_t maxNumBinaryEntries = 8,
119  const size_t maxNumStringEntries = 20);
120 
123  virtual void close() = 0;
124 
136  virtual void setReferenceForFillingInReferenceCoordinates(const PagedImage* refImg = nullptr);
137 
140 
143 
144 protected:
148 
149 private:
151  const PagedImage* _referencePagedImage;
152 
155  size_t _currentImageIndex;
156 
159 };
160 
161 ML_END_NAMESPACE
Project global and OS specific declarations.
#define MLFileReaderPluginsBase_EXPORT
DLL export macro definition.
Base class for a generic file reader plugin with factory interface.
virtual bool isSupported(const std::string &fileName) const =0
Applies a fast check whether the file is probably supported or not, for example via the suffix.
virtual void setSelectedImageIndex(size_t idx=0)
Selects which image from inside the loaded file shall be used.
virtual bool supportsFillingInReferenceCoordinates() const
Returns true if the loader instance support SubImage filling in reference coordinates,...
virtual const PagedImage * getReferenceForFillingInReferenceCoordinates() const
Returns the recently set "enabled" state set with setSubImageFillingInReferenceCoordinates().
virtual ~FileReaderPluginsBase()
Destructor cleaning up allocated structures and closing a possibly open file.
virtual std::string getCodedImageIndexString(unsigned int imgIdx)
If getNumberOfImagesInFile() is <=1 then the plugin string id getTypeId()->getName() is returned,...
virtual unsigned int extractImageIndexValue(const std::string &codedLoaderPluginString)
From a string of the format "LoaderPluginName+#IDX" extract "IDX" as unsigned int,...
virtual size_t getNumberOfImagesInFile()=0
Returns the number of images which are accessible in the loaded file; normally one,...
virtual void setReferenceForFillingInReferenceCoordinates(const PagedImage *refImg=nullptr)
If a valid PagedImage pointer is passed then each fillSubImage operation will take into account the d...
virtual void close()=0
Closes the file and cleans up data structures.
virtual std::string getTagDump(const size_t maxNumBinaryEntries=8, const size_t maxNumStringEntries=20)
This function returns a tag or meta data dump of the loaded file or an empty string if not possible (...
virtual MLErrorCode loadFile(const std::string &fileName)=0
Opens and loads a file such that getPagedImageProperties() and fillSubImage() can be used to retrieve...
static FileReaderPluginsBase * createLoaderInstance(const std::string &fileName)
Factory functionality: Instantiate a loader for the file name fileName and return a new instance of i...
virtual size_t getSelectedImageIndex() const
Returns the currently selected image from inside the loaded file.
virtual double getPluginPriority() const
Returns a priority over other loader plugins, low priorities mean that other loader plugins with high...
virtual MLErrorCode fillSubImage(SubImage &dstSubImage)=0
Copy overlapping regions in dstSubImage with image data from the loaded file; note that the calculati...
virtual const PagedImage & getPagedImageProperties()=0
Returns the properties of the currently loaded image.
ImageVector _determineWorldDifferenceAsVoxelShift(const PagedImage &destination) const
Determines a translation vector for SubImages boxes which represents the world difference between the...
FileReaderPluginsBase()
Constructor.
Class which represents an image, which manages properties of an image and image data which is located...
Definition: mlPagedImage.h:70
This class manages/represents a rectangular 6d image region which is organized linearly in memory.
Definition: mlSubImage.h:75
MLint32 MLErrorCode
Type of an ML Error code.
Definition: mlTypeDefs.h:818
#define ML_ABSTRACT_ROOT_CLASS_HEADER(className)