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
15
17#include <mlByteDataReader.h>
18#include <mlDMFileReaderDefs.h>
19#include <mlPagedImage.h>
20#include <mlSubImage.h>
21
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
166MLDMFileReader_EXPORT std::ostream& operator<<(std::ostream& os, const DMFileReader &obj);
167
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.
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 ...
DMTagPtrVector & getTags()
Returns the map with all group and data tags.
const PagedImage & getPagedImage(size_t index)
Initializes and returns the currently used PagedImage settings where index specifies which one of pos...
~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.
DMTagPtrVector & getGroupTags()
Returns the map with all group tags.
DMImagePtr getImage() const
Returns the current image member as constant reference.
MLuint64 getFileSize() const
Returns the size of the file from header.
bool isDM4() const
Returns true if currently a .dm4 file is loaded.
DMTagPtrVector & getDataTags()
Returns the map with all data tags.
DMTagDirectory & getGroupTagMap()
Returns the global map with all group tags.
SubImage & getSubImage(size_t index)
Returns the entire image data as SubImage.
MLuint64 getImageFormatVersion() const
Returns the version of the currently loaded image.
DMTagDirectory & getTagMap()
Returns the global map with all data and group tags.
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.
DMTagDirectory & getDataTagMap()
Returns the global 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...
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.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
#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:425
std::ostream & operator<<(std::ostream &out, const ml::Variant &variant)
Definition mlVariant.h:210
boost::shared_ptr< DMImage > DMImagePtr
Boost shared-pointer type definitions for DMImage.
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.