comparison OrthancFramework/Sources/DicomFormat/DicomMap.h @ 4932:b7ce2bb6b881 more-tags

refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
author Alain Mazy <am@osimis.io>
date Wed, 09 Mar 2022 11:17:08 +0100
parents 43e613a7756b
children 312c6f4da888
comparison
equal deleted inserted replaced
4930:1ce32c1ec4cf 4932:b7ce2bb6b881
29 29
30 #include <set> 30 #include <set>
31 #include <map> 31 #include <map>
32 #include <json/value.h> 32 #include <json/value.h>
33 33
34 #if ORTHANC_BUILD_UNIT_TESTS == 1
35 # include <gtest/gtest_prod.h>
36 #endif
37
34 namespace Orthanc 38 namespace Orthanc
35 { 39 {
36 class ORTHANC_PUBLIC DicomMap : public boost::noncopyable 40 class ORTHANC_PUBLIC DicomMap : public boost::noncopyable
37 { 41 {
38 public: 42 public:
39 typedef std::map<DicomTag, DicomValue*> Content; 43 typedef std::map<DicomTag, DicomValue*> Content;
40 44
41 private: 45 private:
46 class MainDicomTagsConfiguration;
42 friend class DicomArray; 47 friend class DicomArray;
43 friend class FromDcmtkBridge; 48 friend class FromDcmtkBridge;
44 friend class ParsedDicomFile; 49 friend class ParsedDicomFile;
50
51 #if ORTHANC_BUILD_UNIT_TESTS == 1
52 friend class DicomMapMainTagsTests;
53 #endif
45 54
46 Content content_; 55 Content content_;
47 56
48 // Warning: This takes the ownership of "value" 57 // Warning: This takes the ownership of "value"
49 void SetValueInternal(uint16_t group, 58 void SetValueInternal(uint16_t group,
50 uint16_t element, 59 uint16_t element,
51 DicomValue* value); 60 DicomValue* value);
52 61
53 static void GetMainDicomTagsInternal(std::set<DicomTag>& result, 62 // used for unit tests only
54 ResourceType level); 63 static void ResetDefaultMainDicomTags();
55 64
56 public: 65 public:
57 ~DicomMap(); 66 ~DicomMap();
58 67
59 size_t GetSize() const; 68 size_t GetSize() const;
122 131
123 static bool IsMainDicomTag(const DicomTag& tag, ResourceType level); 132 static bool IsMainDicomTag(const DicomTag& tag, ResourceType level);
124 133
125 static bool IsMainDicomTag(const DicomTag& tag); 134 static bool IsMainDicomTag(const DicomTag& tag);
126 135
127 static void GetMainDicomTags(std::set<DicomTag>& result, ResourceType level); 136 static const std::set<DicomTag>& GetMainDicomTags(ResourceType level);
128 137
129 static void GetMainDicomTags(std::set<DicomTag>& result); 138 static const std::set<DicomTag>& GetAllMainDicomTags();
139
140 // adds a main dicom tag to the definition of main dicom tags for each level.
141 // this should be done once at startup before you use MainDicomTags methods
142 static void AddMainDicomTag(const DicomTag& tag, const std::string& name, ResourceType level);
130 143
131 void GetTags(std::set<DicomTag>& tags) const; 144 void GetTags(std::set<DicomTag>& tags) const;
132 145
133 static bool IsDicomFile(const void* dicom, 146 static bool IsDicomFile(const void* dicom,
134 size_t size); 147 size_t size);