MeVisLab Toolbox Reference
mlDICOMTagDescriptions.h
Go to the documentation of this file.
1 // Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2 // **InsertLicense** code
3 //----------------------------------------------------------------------------------
6 
11 //----------------------------------------------------------------------------------
12 #pragma once
13 
14 #include "MLDICOMTagsSystem.h"
15 
16 #include <ThirdPartyWarningsDisable.h>
17 #include <map>
18 #include <string>
19 #include <vector>
20 #include <ThirdPartyWarningsRestore.h>
21 
22 #include <mlUtilsSystem.h>
23 
24 // DICOM Tree prototypes.
25 #include <DCMTree_Lib.h>
26 namespace DCMTree {
27  class TagId;
28 }
29 
30 ML_START_NAMESPACE
31 
32 //----------------------------------------------------------------------------------
34 //----------------------------------------------------------------------------------
35 namespace DICOMTagInformation {
36 
45 extern MLDICOMTags_EXPORT const char * const DICOMTagFullInfos[][6];
46 
47 //----------------------------------------------------------------------------------
50 //----------------------------------------------------------------------------------
52 
53 public:
55  inline DICOMTagInfoEntry(): typeBits(0), indexes(){};
56 
59  enum TagTypeBits {
60  Type1_Tag = 1,
61  Type1C_Tag = 2,
62  Type2_Tag = 4,
63  Type2C_Tag = 8,
64  Type3_Tag = 16,
65  OtherType_Tag = 32
66  };
67 
69  size_t typeBits;
70 
72  std::vector<size_t> indexes;
73 
75  inline bool isPureType() const{
76  return (typeBits == Type1_Tag ) ||
77  (typeBits == Type1C_Tag) ||
78  (typeBits == Type2_Tag ) ||
79  (typeBits == Type2C_Tag) ||
80  (typeBits == Type3_Tag );
81  }
82 
84  inline std::string getTypeDescriptionList() const{
85  std::string retList;
86  if (typeBits & Type1_Tag ){ retList += retList.empty() ? "1" : ", 1" ; }
87  if (typeBits & Type1C_Tag ){ retList += retList.empty() ? "1C" : ", 1C"; }
88  if (typeBits & Type2_Tag ){ retList += retList.empty() ? "2" : ", 2" ; }
89  if (typeBits & Type2C_Tag ){ retList += retList.empty() ? "2C" : ", 2C"; }
90  if (typeBits & Type3_Tag ){ retList += retList.empty() ? "3" : ", 3" ; }
91  if (typeBits & OtherType_Tag){ retList += retList.empty() ? "Other or unknown" : ", other or unknown"; }
92  return retList;
93  }
94 
95 };
96 
97 //----------------------------------------------------------------------------------
100 //----------------------------------------------------------------------------------
102  public:
103 
105  std::map< DCMTree::RawTagId, size_t > idToFirstDescEntry;
106 
108  std::map< std::string, DICOMTagInfoEntry > tagTypeBits;
109 
111  std::vector< size_t > Type1Tags;
112 
114  std::vector< size_t > Type1CTags;
115 
117  std::vector< size_t > Type2Tags;
118 
120  std::vector< size_t > Type2CTags;
121 
123  std::vector< size_t > Type3Tags;
124 
126  std::vector< size_t > Type1AndOtherTags;
127 
130  std::vector< size_t > Type2AndOtherTags;
131 
133  std::vector< size_t > TypeUnknownTags;
134 
137 
150  static bool getTagInformation(const DCMTree::TagId &tagId,
151  const std::string &prefix,
152  std::string *chapterIndex = nullptr,
153  std::string *chapterName = nullptr,
154  std::string *tagTextName = nullptr,
155  std::string *tagType = nullptr,
156  std::string *tagDesc = nullptr);
157 
158 private:
161  static void _initializeDICOMTagTables(DICOMTagDescriptions &tagTabs);
162 };
163 
164 };
165 
166 ML_END_NAMESPACE
Project global and OS specific declarations.
#define MLDICOMTags_EXPORT
If included by external modules, exported symbols are declared as import symbols.
Class to wrap a tag-id.
Definition: DCMTree_TagId.h:40
Container to manage some tag information such as the indexes to all appearances of the tag in DICOMTa...
std::map< std::string, DICOMTagInfoEntry > tagTypeBits
Map storing type bits and table entries where it appears for all tag ids.
std::vector< size_t > Type3Tags
Indexes of tags only of type "3 ".
static const DICOMTagDescriptions & getDICOMTagDescriptions()
Function which returns a reference to all available DICOMTagDescriptions.
std::map< DCMTree::RawTagId, size_t > idToFirstDescEntry
Map storing a mapping of DCMTree::RawTagId values to first matching entry of DICOMTagFullInfos.
std::vector< size_t > Type2CTags
Indexes of tags only of type "2C".
std::vector< size_t > Type1AndOtherTags
Indexes of mixed tags of at least a type 1 or type 1C and at least another type.
std::vector< size_t > Type1Tags
Indexes of tags only of type "1 ".
std::vector< size_t > Type2AndOtherTags
Indexes of mixed tags which are at least of two of the the types 2, 2C, 3 or other,...
std::vector< size_t > TypeUnknownTags
Indexes of all other tags having unidentified types.
static bool getTagInformation(const DCMTree::TagId &tagId, const std::string &prefix, std::string *chapterIndex=nullptr, std::string *chapterName=nullptr, std::string *tagTextName=nullptr, std::string *tagType=nullptr, std::string *tagDesc=nullptr)
Returns descriptive information in passed non-nullptr string arguments about the given tag id.
std::vector< size_t > Type2Tags
Indexes of tags only of type "2 ".
std::vector< size_t > Type1CTags
Indexes of tags only of type "1C".
Class managing some bits needed to initialize tag tables as well as a vector of indexes into table wh...
DICOMTagInfoEntry()
Constructor resettings to no set bits and empty indexes vector.
size_t typeBits
Composition of bits from TagTypeBits describing possibly types the tag can have.
TagTypeBits
An enumerator describing possible bits which can be ored to a bit mask which describes possible types...
std::vector< size_t > indexes
Vector of indexes to all entries of DICOMTagFullInfos in which the tag appears.
bool isPureType() const
Returns true if it is exclusively of one valid type (1, 1C, 2, 2C, or 3), otherwise false.
std::string getTypeDescriptionList() const
Returns a comma separated list of strings of tag types according to the bits in typeBits.
class to dump a DCMTree dicom message into a human readable file this class could be used as a starte...
MLDICOMTags_EXPORT const char *const DICOMTagFullInfos[][6]
Information table of the following structure with the following entries: