MeVisLab Toolbox Reference
ml::DMFileReader Class Reference

A tool classes to load Digital Microscopy files. More...

#include <mlDMFileReader.h>

Inheritance diagram for ml::DMFileReader:
ml::ByteDataReader

Public Member Functions

 DMFileReader ()
 Default constructor which gets its settings later. More...
 
 DMFileReader (const std::string &fileName)
 Constructor already setting the file name. More...
 
 ~DMFileReader () override
 Destructor (automatically closes the current open file if there is any and clear allocated subimage data). More...
 
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. More...
 
void close () override
 Closes the file if it was open, otherwise the call is ignored. More...
 
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. More...
 
MLuint64 getVersion () const
 Returns the version of the file. More...
 
MLuint64 getFileSize () const
 Returns the size of the file from header. More...
 
MLuint64 getImageFormatVersion () const
 Returns the version of the currently loaded image. More...
 
bool isDM3 () const
 Returns true if currently a .dm3 file is loaded. More...
 
bool isDM4 () const
 Returns true if currently a .dm4 file is loaded. More...
 
DMImagePtr getImage () const
 Returns the current image member as constant reference. More...
 
DMTagDirectorygetTagMap ()
 Returns the global map with all data and group tags. More...
 
DMTagPtrVectorgetTags ()
 Returns the map with all group and data tags. More...
 
DMTagDirectorygetDataTagMap ()
 Returns the global map with all data tags. More...
 
DMTagPtrVectorgetDataTags ()
 Returns the map with all data tags. More...
 
DMTagDirectorygetGroupTagMap ()
 Returns the global map with all group tags. More...
 
DMTagPtrVectorgetGroupTags ()
 Returns the map with all group tags. More...
 
size_t getNumberOfImageStructures ()
 Returns the number of image structures inside of the loaded tags. More...
 
SubImagegetSubImage (size_t index)
 Returns the entire image data as SubImage. More...
 
const PagedImagegetPagedImage (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. More...
 
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. More...
 
- Public Member Functions inherited from ml::ByteDataReader
 ByteDataReader ()
 Default constructor which gets its settings later. More...
 
 ByteDataReader (const std::string &fileName)
 Constructor already setting the file name. More...
 
virtual ~ByteDataReader ()
 Destructor (automatically closes the current open file if there is any and clear allocated subimage data). More...
 
virtual std::string getFileName () const
 Returns the currently used file name or "" on default case. More...
 
virtual void setFileName (const std::string &fileName)
 Sets the new file name. More...
 
virtual bool isOpen () const
 Returns true if the file is open, otherwise false. More...
 
virtual bool isGood () const
 Returns true if the recent operations since the last clearState() call were successful. More...
 
virtual std::string getErrorState () const
 Returns the current state string which is non empty on any error, empty otherwise. More...
 
virtual void clearErrorState ()
 Resets the error state to success, i.e. to an empty string. More...
 
virtual void setIndent (const std::string &indent)
 Sets the default indentation string for tag dumps. More...
 
virtual const std::string & getIndent () const
 The default indentation string for tag dumps. More...
 
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. More...
 
virtual void prefetch ()
 Loads all file content into memory to avoid expensive file descriptor access on each get*Word call. More...
 
virtual const MLuint8getPrefetchData () const
 Returns pointer to prefetch data (or nullptr if not available). More...
 
virtual void clearPrefetchData ()
 If any data is in the prefetch data memory then it is freed. More...
 
MLuint8 get8BitUWord (MLuint64 pos) const
 Read an unsigned 8 bit word from position pos. More...
 
MLuint16 get16BitUWord (MLuint64 pos) const
 Read an unsigned 16 bit word from position pos. More...
 
MLuint16 get16BitUWordInLocalEndianess (MLuint64 pos) const
 Read an unsigned 16 bit word from position pos and convert it in local endianness. More...
 
MLuint32 get32BitUWord (MLuint64 pos) const
 Read an unsigned 32 bit word from position pos. More...
 
MLuint32 get32BitUWordInLocalEndianess (MLuint64 pos) const
 Read an unsigned 32 bit word from position pos and convert it in local endianness. More...
 
MLuint64 get64BitUWord (MLuint64 pos) const
 Read an unsigned 64 bit word from position pos. More...
 
MLuint64 get64BitUWordInLocalEndianess (MLuint64 pos) const
 Read an unsigned 64 bit word from position pos and convert it in local endianness. More...
 
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. More...
 
MLuint8getDataChunk (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(). More...
 
const MLuint8getPrefetchDataChunk (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. More...
 
MLint getFileSizeFromCurrentDescriptor ()
 Returns MLFileGetSizeFromDescriptor(_getFileDescriptor()). More...
 
void appendStringToState (const std::string &errDesc) const
 Appends the given string to error state string (which also sets bad read state). More...
 

Friends

class DMImage
 Allow internal class to access this. More...
 
class DMTag
 

Additional Inherited Members

- Protected Member Functions inherited from ml::ByteDataReader
int _getFileDescriptor () const
 Returns the current file descriptor. More...
 
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. More...
 
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. More...
 

Detailed Description

A tool classes to load Digital Microscopy files.

Definition at line 27 of file mlDMFileReader.h.

Constructor & Destructor Documentation

◆ DMFileReader() [1/2]

ml::DMFileReader::DMFileReader ( )

Default constructor which gets its settings later.

◆ DMFileReader() [2/2]

ml::DMFileReader::DMFileReader ( const std::string &  fileName)

Constructor already setting the file name.

◆ ~DMFileReader()

ml::DMFileReader::~DMFileReader ( )
override

Destructor (automatically closes the current open file if there is any and clear allocated subimage data).

Member Function Documentation

◆ close()

void ml::DMFileReader::close ( )
overridevirtual

Closes the file if it was open, otherwise the call is ignored.

Reimplemented from ml::ByteDataReader.

◆ getAsString()

virtual std::string ml::DMFileReader::getAsString ( const std::string &  prefix = "",
const std::string &  sep = ", ",
const size_t  maxNumBinaryEntries = 8,
const size_t  maxNumStringEntries = 20 
) const
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.

◆ getDataTagMap()

DMTagDirectory& ml::DMFileReader::getDataTagMap ( )

Returns the global map with all data tags.

◆ getDataTags()

DMTagPtrVector& ml::DMFileReader::getDataTags ( )

Returns the map with all data tags.

◆ getDMIndexUWord()

MLuint64 ml::DMFileReader::getDMIndexUWord ( MLuint64  pos) const

Read an unsigned 32 bit word from .dm3 files and a 64 bit one from .dm4 files from position pos.

◆ getFileSize()

MLuint64 ml::DMFileReader::getFileSize ( ) const

Returns the size of the file from header.

◆ getGroupTagMap()

DMTagDirectory& ml::DMFileReader::getGroupTagMap ( )

Returns the global map with all group tags.

◆ getGroupTags()

DMTagPtrVector& ml::DMFileReader::getGroupTags ( )

Returns the map with all group tags.

◆ getImage()

DMImagePtr ml::DMFileReader::getImage ( ) const

Returns the current image member as constant reference.

◆ getImageFormatVersion()

MLuint64 ml::DMFileReader::getImageFormatVersion ( ) const

Returns the version of the currently loaded image.

◆ getNumberOfImageStructures()

size_t ml::DMFileReader::getNumberOfImageStructures ( )

Returns the number of image structures inside of the loaded tags.

◆ getPagedImage()

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.


◆ getSubImage()

SubImage& ml::DMFileReader::getSubImage ( size_t  index)

Returns the entire image data as SubImage.

◆ getTagMap()

DMTagDirectory& ml::DMFileReader::getTagMap ( )

Returns the global map with all data and group tags.

◆ getTags()

DMTagPtrVector& ml::DMFileReader::getTags ( )

Returns the map with all group and data tags.

◆ getVersion()

MLuint64 ml::DMFileReader::getVersion ( ) const

Returns the version of the file.

◆ isDM3()

bool ml::DMFileReader::isDM3 ( ) const

Returns true if currently a .dm3 file is loaded.

◆ isDM4()

bool ml::DMFileReader::isDM4 ( ) const

Returns true if currently a .dm4 file is loaded.

◆ open()

void ml::DMFileReader::open ( )
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.

Friends And Related Function Documentation

◆ DMImage

friend class DMImage
friend

Allow internal class to access this.

Definition at line 115 of file mlDMFileReader.h.

◆ DMTag

friend class DMTag
friend

Definition at line 116 of file mlDMFileReader.h.


The documentation for this class was generated from the following file: