comparison OrthancServer/FromDcmtkBridge.h @ 304:4eea080e6e7a

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 19 Dec 2012 14:57:18 +0100
parents 238134081136
children 86bb79522f19
comparison
equal deleted inserted replaced
303:c76a35a85c69 304:4eea080e6e7a
69 69
70 void ReplaceInternal(const DicomTag& tag, 70 void ReplaceInternal(const DicomTag& tag,
71 const std::string& value, 71 const std::string& value,
72 bool insertOnAbsent); 72 bool insertOnAbsent);
73 73
74 void Setup(const char* content,
75 size_t size);
76
74 public: 77 public:
75 ParsedDicomFile(const std::string& content); 78 ParsedDicomFile(const char* content,
79 size_t size)
80 {
81 Setup(content, size);
82 }
83
84 ParsedDicomFile(const std::string& content)
85 {
86 if (content.size() == 0)
87 Setup(NULL, 0);
88 else
89 Setup(&content[0], content.size());
90 }
76 91
77 DcmFileFormat& GetDicom() 92 DcmFileFormat& GetDicom()
78 { 93 {
79 return *file_; 94 return *file_;
80 } 95 }
128 unsigned int frame, 143 unsigned int frame,
129 ImageExtractionMode mode); 144 ImageExtractionMode mode);
130 145
131 static std::string GetName(const DicomTag& tag); 146 static std::string GetName(const DicomTag& tag);
132 147
133 static DicomTag FindTag(const char* name); 148 static DicomTag ParseTag(const char* name);
134 149
135 static DicomTag FindTag(const std::string& name) 150 static DicomTag ParseTag(const std::string& name)
136 { 151 {
137 return FindTag(name.c_str()); 152 return ParseTag(name.c_str());
138 } 153 }
139 154
140 static bool HasTag(const DicomMap& fields, 155 static bool HasTag(const DicomMap& fields,
141 const std::string& tagName) 156 const std::string& tagName)
142 { 157 {
143 return fields.HasTag(FindTag(tagName)); 158 return fields.HasTag(ParseTag(tagName));
144 } 159 }
145 160
146 static const DicomValue& GetValue(const DicomMap& fields, 161 static const DicomValue& GetValue(const DicomMap& fields,
147 const std::string& tagName) 162 const std::string& tagName)
148 { 163 {
149 return fields.GetValue(FindTag(tagName)); 164 return fields.GetValue(ParseTag(tagName));
150 } 165 }
151 166
152 static void SetValue(DicomMap& target, 167 static void SetValue(DicomMap& target,
153 const std::string& tagName, 168 const std::string& tagName,
154 DicomValue* value) 169 DicomValue* value)
155 { 170 {
156 target.SetValue(FindTag(tagName), value); 171 target.SetValue(ParseTag(tagName), value);
157 } 172 }
158 173
159 static void Print(FILE* fp, 174 static void Print(FILE* fp,
160 const DicomMap& m); 175 const DicomMap& m);
161 176