MeVisLab Toolbox Reference
mlDMFileReader.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 
14 #include "MLDMFileReaderSystem.h"
15 
17 #include <mlByteDataReader.h>
18 #include <mlDMFileReaderDefs.h>
19 #include <mlPagedImage.h>
20 #include <mlSubImage.h>
21 
22 ML_START_NAMESPACE
23 
24 //----------------------------------------------------------------------------------
26 //----------------------------------------------------------------------------------
28  public:
29 
32 
34  DMFileReader(const std::string &fileName);
35 
38  ~DMFileReader() override;
39 
43  void open() override;
44 
46  void close() override;
47 
50 
53 
56 
59 
61  bool isDM3() const;
62 
64  bool isDM4() const;
65 
68 
71 
74 
77 
80 
83 
86 
89 
91  SubImage &getSubImage(size_t index);
92 
96  const PagedImage &getPagedImage(size_t index);
97 
107  virtual std::string getAsString(const std::string &prefix="",
108  const std::string &sep=", ",
109  const size_t maxNumBinaryEntries=8,
110  const size_t maxNumStringEntries=20) const override;
111 
112  private:
113 
115  friend class DMImage;
116  friend class DMTag;
117 
120  void _selectImageDataStruct(size_t index);
121 
123  void _initializeSubImage(size_t index);
124 
126  MLuint64 _version;
127 
129  mutable DMTagDirectoryPtr _tagMap;
130 
132  mutable DMTagDirectoryPtr _groupTagMap;
133 
135  mutable DMTagDirectoryPtr _dataTagMap;
136 
138  mutable DMImagePtr _imagePtr;
139 
141  std::vector<DMImageDataStructPtr> _imgList;
142 
144  bool _imgListValid;
145 
147  MLuint64 _numberOfImageStructures;
148 
150  size_t _currentImageDataStructIndex;
151 
153  DMImageDataStructPtr _imageDataStructPtr;
154 
156  PagedImage _pagedImage;
157 
159  SubImage _subImage;
160 
163 };
164 
166 MLDMFileReader_EXPORT std::ostream& operator<<(std::ostream& os, const DMFileReader &obj);
167 
168 ML_END_NAMESPACE
Project global and OS specific declarations.
#define MLDMFileReader_EXPORT
If included by external modules, exported symbols are declared as import symbols.
Base class to implement raw data loaders which need byte swapping and basic file access on byte or ra...
A tool classes to load Digital Microscopy files.
DMTagDirectory & getGroupTagMap()
Returns the global map with all group tags.
DMFileReader(const std::string &fileName)
Constructor already setting the file name.
size_t getNumberOfImageStructures()
Returns the number of image structures inside of the loaded tags.
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 ...
DMTagDirectory & getTagMap()
Returns the global map with all data and group tags.
~DMFileReader() override
Destructor (automatically closes the current open file if there is any and clear allocated subimage d...
void open() override
Opens the file if possible, isGood() will return true on success, otherwise false; if byte swapping m...
DMFileReader()
Default constructor which gets its settings later.
DMImagePtr getImage() const
Returns the current image member as constant reference.
const PagedImage & getPagedImage(size_t index)
Initializes and returns the currently used PagedImage settings where index specifies which one of pos...
MLuint64 getFileSize() const
Returns the size of the file from header.
bool isDM4() const
Returns true if currently a .dm4 file is loaded.
DMTagPtrVector & getTags()
Returns the map with all group and data tags.
DMTagDirectory & getDataTagMap()
Returns the global map with all data tags.
DMTagPtrVector & getGroupTags()
Returns the map with all group tags.
MLuint64 getImageFormatVersion() const
Returns the version of the currently loaded image.
bool isDM3() const
Returns true if currently a .dm3 file is loaded.
MLuint64 getVersion() const
Returns the version of the file.
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.
void close() override
Closes the file if it was open, otherwise the call is ignored.
SubImage & getSubImage(size_t index)
Returns the entire image data as SubImage.
DMTagPtrVector & getDataTags()
Returns the map with all data tags.
Representation for the DM file as data structure.
Definition: mlDMImage.h:24
Representation for the DM file as data structure.
Representation for the DM file as data structure.
Definition: mlDMTag.h:24
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
Basic binary data loader class.
Project wide definitions.
#define ML_CLASS_HEADER(className)
Same like ML_CLASS_HEADER_EXPORTED with a non existing export symbol.
UINT64 MLuint64
Introduce platform independent 64 bit unsigned integer type.
Definition: mlTypeDefs.h:513
boost::shared_ptr< DMImage > DMImagePtr
Boost shared-pointer type definitions for DMImage.
MLDMFileReader_EXPORT std::ostream & operator<<(std::ostream &os, const DMFileReader &obj)
Output to std::ostream.
std::vector< DMTagPtr > DMTagPtrVector
Vector of shared pointers to DMTags.
boost::shared_ptr< DMTagDirectory > DMTagDirectoryPtr
Boost shared-pointer type definitions for DMTagMap.
boost::shared_ptr< DMImageDataStruct > DMImageDataStructPtr
Boost shared-pointer type definitions for DMIMageDataStruct.