MeVisLab Toolbox Reference
mlImageFormatTagList.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef ML_IMAGE_FORMAT_TAG_LIST_H
14#define ML_IMAGE_FORMAT_TAG_LIST_H
15
18
19// Resolve platform independencies.
21
22#include "mlModuleIncludes.h"
23
24#include "mlImageFormatTag.h"
25
26// Implement everything in ML namespace.
27ML_START_NAMESPACE
28
30 class DataCompressor;
31
33 class MLImageFormatInfos;
34 class MLImageFormatAbstractFileHandle;
35
36 //----------------------------------------------------------------------
38 //----------------------------------------------------------------------
39 class MLIMAGEFORMATBASE_EXPORT MLImageFormatTagList : public std::vector<MLImageFormatTag>{
40 public:
41
42 //----------------------------------------------------------------------
43 // CPU specific storage order of data in memory.
44 //----------------------------------------------------------------------
45 static const MLint ML_LITTLE_ENDIAN ;
46 static const MLint ML_BIG_ENDIAN ;
47
48 //----------------------------------------------------------------------
50 //----------------------------------------------------------------------
51 static const std::string ML_DICOM_TAG_PREFIX;
52
53 //--------------------------------------------------------------------------------
55 //--------------------------------------------------------------------------------
56 static const std::string ML_TAG_LIST_SIZE_IN_BYTES_TAG;
57
58 //--------------------------------------------------------------------------------
60 //--------------------------------------------------------------------------------
62
63
64 //------------------------------------------------------------------
67 //------------------------------------------------------------------
68
71
75
77 void tagListOut(std::ostream &ostr) const;
78
80 std::string getTagListAsString() const;
81
84 const MLImageFormatTag *findConstTag(const std::string &tagName) const;
85
88 MLint findTagIdx(const std::string &tagName) const;
89
93 bool checkTag(const std::string &tagName, MLint &val) const;
94
98 bool checkTag(const std::string &tagName, std::string &val) const;
99
103 bool checkTag(const std::string &tagName, MLdouble &val) const;
104
108 bool checkTag(const std::string &tagName, MLldouble &val) const;
109
113
123 char* getHeaderAndListAsBinary(size_t &memSize,
124 MLuint32 saveModeBits) const;
125
136 MLuint filePos,
137 MLuint32 saveModeBits) const;
138
149
150
164 const DataCompressor *compressor,
165 const MLImageFormatTagList &compressionTagList,
166 const MLImageFormatTagList &userTagList,
167 const MLImageFormatTagList &privateTagList,
168 const std::string &defaultVoxelValue,
169 MLuint32 saveModeBits);
170
187 MLint &endianness,
188 std::string &compressorName,
189 std::string &compressorVersion,
190 MLImageFormatTagList &compressionTagList,
191 MLImageFormatTagList &userTagList,
192 MLImageFormatTagList &privateTagList,
193 std::string &defaultVoxelValue,
194 MLint &usesCheckSum,
195 MLint &usesPartialPages);
196
207
214 void appendSpecialTags(const std::string &numTagsTagName,
215 const std::string &tagNamePrefix,
216 const MLImageFormatTagList &sourceTagList);
217
228 MLErrorCode extractSpecialTags(const std::string &numTagsTagName,
229 const std::string &tagNamePrefix,
230 MLImageFormatTagList &targetTagList) const;
231 };
232
233ML_END_NAMESPACE
234
235#endif // of __mlImageFormatTagList_H
236
#define MLIMAGEFORMATBASE_EXPORT
bool checkTag(const std::string &tagName, MLldouble &val) const
MLuint getExpectedHeaderAndListSizeAsBinary() const
bool checkTag(const std::string &tagName, MLdouble &val) const
static const std::string ML_TAG_LIST_SIZE_IN_BYTES_TAG
Name of first tag whose value denotes the size of the entire tag list size.
MLint findTagIdx(const std::string &tagName) const
static const MLint ML_LITTLE_ENDIAN
Little endian.
MLErrorCode appendImageProperties(const PagedImage &props, const DataCompressor *compressor, const MLImageFormatTagList &compressionTagList, const MLImageFormatTagList &userTagList, const MLImageFormatTagList &privateTagList, const std::string &defaultVoxelValue, MLuint32 saveModeBits)
MLErrorCode extractImageProperties(PagedImage &props, MLint &endianness, std::string &compressorName, std::string &compressorVersion, MLImageFormatTagList &compressionTagList, MLImageFormatTagList &userTagList, MLImageFormatTagList &privateTagList, std::string &defaultVoxelValue, MLint &usesCheckSum, MLint &usesPartialPages)
MLuint getTagListSizeInBytes() const
MLErrorCode extractSpecialTags(const std::string &numTagsTagName, const std::string &tagNamePrefix, MLImageFormatTagList &targetTagList) const
MLErrorCode load(MLImageFormatAbstractFileHandle *fileHandle, MLint filePos=0)
static const std::string ML_DICOM_TAG_PREFIX
Name prefix for all stored DICOM tags.
MLErrorCode save(MLImageFormatAbstractFileHandle *fileHandle, MLuint filePos, MLuint32 saveModeBits) const
void tagListOut(std::ostream &ostr) const
Passes the tag list into the stream ostr.
static const MLImageFormatTagList & getDefaultEmptyTagList()
Returns a default empty tags list. Must be called first time in DLL initialization.
std::string getTagListAsString() const
Passes the tag list into the string str.
MLImageFormatTagList()
Default constructor that is setting name and value to empty strings.
void appendSpecialTags(const std::string &numTagsTagName, const std::string &tagNamePrefix, const MLImageFormatTagList &sourceTagList)
static const MLint ML_BIG_ENDIAN
Big endian.
bool checkTag(const std::string &tagName, std::string &val) const
char * getHeaderAndListAsBinary(size_t &memSize, MLuint32 saveModeBits) const
bool checkTag(const std::string &tagName, MLint &val) const
MLErrorCode extractImageProperties(MLImageFormatInfos &infos)
const MLImageFormatTag * findConstTag(const std::string &tagName) const
Class defining a tag used in the MLImageFormat class.
MLint32 MLErrorCode
Type of an ML Error code.
Definition mlTypeDefs.h:715
long double MLldouble
Definition mlTypeDefs.h:231
unsigned int MLuint32
Definition mlTypeDefs.h:184
MLuint64 MLuint
Definition mlTypeDefs.h:505
double MLdouble
Definition mlTypeDefs.h:216
MLint64 MLint
Definition mlTypeDefs.h:489