MeVisLab Toolbox Reference
|
A tool classes to load Digital Microscopy files. More...
#include <mlDMFileReader.h>
Public Member Functions | |
DMFileReader () | |
Default constructor which gets its settings later. | |
DMFileReader (const std::string &fileName) | |
Constructor already setting the file name. | |
~DMFileReader () override | |
Destructor (automatically closes the current open file if there is any and clear allocated subimage data). | |
void | open () override |
Opens the file if possible, isGood() will return true on success, otherwise false; if byte swapping may be required in file format then derived classes should overwrite this method and call _setNeedsByteSwapping() to make get*BitUWordInLocalEndianess() methods work correctly. | |
void | close () override |
Closes the file if it was open, otherwise the call is ignored. | |
MLuint64 | getDMIndexUWord (MLuint64 pos) const |
Read an unsigned 32 bit word from .dm3 files and a 64 bit one from .dm4 files from position pos. | |
MLuint64 | getVersion () const |
Returns the version of the file. | |
MLuint64 | getFileSize () const |
Returns the size of the file from header. | |
MLuint64 | getImageFormatVersion () const |
Returns the version of the currently loaded image. | |
bool | isDM3 () const |
Returns true if currently a .dm3 file is loaded. | |
bool | isDM4 () const |
Returns true if currently a .dm4 file is loaded. | |
DMImagePtr | getImage () const |
Returns the current image member as constant reference. | |
DMTagDirectory & | getTagMap () |
Returns the global map with all data and group tags. | |
DMTagPtrVector & | getTags () |
Returns the map with all group and data tags. | |
DMTagDirectory & | getDataTagMap () |
Returns the global map with all data tags. | |
DMTagPtrVector & | getDataTags () |
Returns the map with all data tags. | |
DMTagDirectory & | getGroupTagMap () |
Returns the global map with all group tags. | |
DMTagPtrVector & | getGroupTags () |
Returns the map with all group tags. | |
size_t | getNumberOfImageStructures () |
Returns the number of image structures inside of the loaded tags. | |
SubImage & | getSubImage (size_t index) |
Returns the entire image data as SubImage. | |
const PagedImage & | getPagedImage (size_t index) |
Initializes and returns the currently used PagedImage settings where index specifies which one of possibly multiple image data structures from inside the file is used. | |
virtual std::string | getAsString (const std::string &prefix="", const std::string &sep=", ", const size_t maxNumBinaryEntries=8, const size_t maxNumStringEntries=20) const override |
Convert content to a human readable string with the prefix prefix before all lines and separator sep between all subcomponents. | |
Public Member Functions inherited from ml::ByteDataReader | |
ByteDataReader () | |
Default constructor which gets its settings later. | |
ByteDataReader (const std::string &fileName) | |
Constructor already setting the file name. | |
virtual | ~ByteDataReader () |
Destructor (automatically closes the current open file if there is any and clear allocated subimage data). | |
virtual std::string | getFileName () const |
Returns the currently used file name or "" on default case. | |
virtual void | setFileName (const std::string &fileName) |
Sets the new file name. | |
virtual bool | isOpen () const |
Returns true if the file is open, otherwise false. | |
virtual bool | isGood () const |
Returns true if the recent operations since the last clearState() call were successful. | |
virtual std::string | getErrorState () const |
Returns the current state string which is non empty on any error, empty otherwise. | |
virtual void | clearErrorState () |
Resets the error state to success, i.e. to an empty string. | |
virtual void | setIndent (const std::string &indent) |
Sets the default indentation string for tag dumps. | |
virtual const std::string & | getIndent () const |
The default indentation string for tag dumps. | |
bool | needsByteSwapping () const |
Returns true if raw file data needs byte swapping, otherwise false; needs to be set with _setNeedsByteSwapping when opening the file in derived classes. | |
virtual void | prefetch () |
Loads all file content into memory to avoid expensive file descriptor access on each get*Word call. | |
virtual const MLuint8 * | getPrefetchData () const |
Returns pointer to prefetch data (or nullptr if not available). | |
virtual void | clearPrefetchData () |
If any data is in the prefetch data memory then it is freed. | |
MLuint8 | get8BitUWord (MLuint64 pos) const |
Read an unsigned 8 bit word from position pos. | |
MLuint16 | get16BitUWord (MLuint64 pos) const |
Read an unsigned 16 bit word from position pos. | |
MLuint16 | get16BitUWordInLocalEndianess (MLuint64 pos) const |
Read an unsigned 16 bit word from position pos and convert it in local endianness. | |
MLuint32 | get32BitUWord (MLuint64 pos) const |
Read an unsigned 32 bit word from position pos. | |
MLuint32 | get32BitUWordInLocalEndianess (MLuint64 pos) const |
Read an unsigned 32 bit word from position pos and convert it in local endianness. | |
MLuint64 | get64BitUWord (MLuint64 pos) const |
Read an unsigned 64 bit word from position pos. | |
MLuint64 | get64BitUWordInLocalEndianess (MLuint64 pos) const |
Read an unsigned 64 bit word from position pos and convert it in local endianness. | |
std::string | getNonTerminatedDataAsString (MLuint originPosition, MLuint numChars) const |
Return a non-null terminated data area starting at position originPosition of length numChars as std::string. | |
MLuint8 * | getDataChunk (MLuint64 pos, MLuint64 numBytes) const |
Reads numBytes from position pos in the file and returns it as allocated data chunk which has to be freed with MLFree(). | |
const MLuint8 * | getPrefetchDataChunk (MLuint64 pos, MLuint64 numBytes) const |
Returns a data pointer to position pos with size numBytes in the prefetch data if available and if chunk size is sufficient. | |
MLint | getFileSizeFromCurrentDescriptor () |
Returns MLFileGetSizeFromDescriptor(_getFileDescriptor()). | |
void | appendStringToState (const std::string &errDesc) const |
Appends the given string to error state string (which also sets bad read state). | |
Friends | |
class | DMImage |
Allow internal class to access this. | |
class | DMTag |
Additional Inherited Members | |
Protected Member Functions inherited from ml::ByteDataReader | |
int | _getFileDescriptor () const |
Returns the current file descriptor. | |
void | _appendErrNoToState (const std::string &errDesc) const |
Appends the given string as error description, translates errno to an MLErrorCode an also adds that state as an error description. | |
void | _setNeedsByteSwapping (bool needsSwapping) |
To se set to true in open() by derived classes if raw file data needs byte swapping, otherwise it should be set to false; defaults to false. | |
A tool classes to load Digital Microscopy files.
Definition at line 27 of file mlDMFileReader.h.
ml::DMFileReader::DMFileReader | ( | ) |
Default constructor which gets its settings later.
ml::DMFileReader::DMFileReader | ( | const std::string & | fileName | ) |
Constructor already setting the file name.
|
override |
Destructor (automatically closes the current open file if there is any and clear allocated subimage data).
|
overridevirtual |
Closes the file if it was open, otherwise the call is ignored.
Reimplemented from ml::ByteDataReader.
|
overridevirtual |
Convert content to a human readable string with the prefix prefix before all lines and separator sep between all subcomponents.
If a binary tag is displayed then the number of shown values is controlled with maxNumBinaryEntries; if there are more then "..." is displayed instead. If a binary tag of type Uint16 which might be a unicoded string then the number of shown values is controlled with maxNumStringEntries; if there are more then "..." is displayed instead.
Reimplemented from ml::ByteDataReader.
DMTagDirectory & ml::DMFileReader::getDataTagMap | ( | ) |
Returns the global map with all data tags.
DMTagPtrVector & ml::DMFileReader::getDataTags | ( | ) |
Returns the map with all data tags.
Read an unsigned 32 bit word from .dm3 files and a 64 bit one from .dm4 files from position pos.
MLuint64 ml::DMFileReader::getFileSize | ( | ) | const |
Returns the size of the file from header.
DMTagDirectory & ml::DMFileReader::getGroupTagMap | ( | ) |
Returns the global map with all group tags.
DMTagPtrVector & ml::DMFileReader::getGroupTags | ( | ) |
Returns the map with all group tags.
DMImagePtr ml::DMFileReader::getImage | ( | ) | const |
Returns the current image member as constant reference.
MLuint64 ml::DMFileReader::getImageFormatVersion | ( | ) | const |
Returns the version of the currently loaded image.
size_t ml::DMFileReader::getNumberOfImageStructures | ( | ) |
Returns the number of image structures inside of the loaded tags.
const PagedImage & ml::DMFileReader::getPagedImage | ( | size_t | index | ) |
Initializes and returns the currently used PagedImage settings where index specifies which one of possibly multiple image data structures from inside the file is used.
DMTagDirectory & ml::DMFileReader::getTagMap | ( | ) |
Returns the global map with all data and group tags.
DMTagPtrVector & ml::DMFileReader::getTags | ( | ) |
Returns the map with all group and data tags.
MLuint64 ml::DMFileReader::getVersion | ( | ) | const |
Returns the version of the file.
bool ml::DMFileReader::isDM3 | ( | ) | const |
Returns true if currently a .dm3 file is loaded.
bool ml::DMFileReader::isDM4 | ( | ) | const |
Returns true if currently a .dm4 file is loaded.
|
overridevirtual |
Opens the file if possible, isGood() will return true on success, otherwise false; if byte swapping may be required in file format then derived classes should overwrite this method and call _setNeedsByteSwapping() to make get*BitUWordInLocalEndianess() methods work correctly.
Reimplemented from ml::ByteDataReader.
Allow internal class to access this.
Definition at line 115 of file mlDMFileReader.h.
Definition at line 116 of file mlDMFileReader.h.