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.
 
 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.
 
DMTagDirectorygetTagMap ()
 Returns the global map with all data and group tags.
 
DMTagPtrVectorgetTags ()
 Returns the map with all group and data tags.
 
DMTagDirectorygetDataTagMap ()
 Returns the global map with all data tags.
 
DMTagPtrVectorgetDataTags ()
 Returns the map with all data tags.
 
DMTagDirectorygetGroupTagMap ()
 Returns the global map with all group tags.
 
DMTagPtrVectorgetGroupTags ()
 Returns the map with all group tags.
 
size_t getNumberOfImageStructures ()
 Returns the number of image structures inside of the loaded tags.
 
SubImagegetSubImage (size_t index)
 Returns the entire image data as SubImage.
 
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.
 
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 MLuint8getPrefetchData () 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.
 
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().
 
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.
 
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.
 

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 Symbol Documentation

◆ DMImage

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: