Mercurial > hg > orthanc
comparison Core/DicomParsing/ParsedDicomFile.h @ 3691:4922bdd046dd
Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 25 Feb 2020 21:44:09 +0100 |
parents | 94f4a18a79cc |
children | 7610af1532c3 |
comparison
equal
deleted
inserted
replaced
3690:a9ce35d67c3c | 3691:4922bdd046dd |
---|---|
136 bool onlyIfExists); | 136 bool onlyIfExists); |
137 | 137 |
138 void Replace(const DicomTag& tag, | 138 void Replace(const DicomTag& tag, |
139 const std::string& utf8Value, | 139 const std::string& utf8Value, |
140 bool decodeDataUriScheme, | 140 bool decodeDataUriScheme, |
141 DicomReplaceMode mode); | 141 DicomReplaceMode mode, |
142 const std::string& privateCreator /* used only for private tags */); | |
142 | 143 |
143 void Replace(const DicomTag& tag, | 144 void Replace(const DicomTag& tag, |
144 const Json::Value& value, // Assumed to be encoded with UTF-8 | 145 const Json::Value& value, // Assumed to be encoded with UTF-8 |
145 bool decodeDataUriScheme, | 146 bool decodeDataUriScheme, |
146 DicomReplaceMode mode); | 147 DicomReplaceMode mode, |
148 const std::string& privateCreator /* used only for private tags */); | |
147 | 149 |
148 void Insert(const DicomTag& tag, | 150 void Insert(const DicomTag& tag, |
149 const Json::Value& value, // Assumed to be encoded with UTF-8 | 151 const Json::Value& value, // Assumed to be encoded with UTF-8 |
150 bool decodeDataUriScheme); | 152 bool decodeDataUriScheme, |
151 | 153 const std::string& privateCreator /* used only for private tags */); |
154 | |
155 // Cannot be applied to private tags | |
152 void ReplacePlainString(const DicomTag& tag, | 156 void ReplacePlainString(const DicomTag& tag, |
153 const std::string& utf8Value) | 157 const std::string& utf8Value); |
154 { | 158 |
155 Replace(tag, utf8Value, false, DicomReplaceMode_InsertIfAbsent); | 159 // Cannot be applied to private tags |
156 } | |
157 | |
158 void SetIfAbsent(const DicomTag& tag, | 160 void SetIfAbsent(const DicomTag& tag, |
159 const std::string& utf8Value) | 161 const std::string& utf8Value); |
160 { | |
161 std::string currentValue; | |
162 if (!GetTagValue(currentValue, tag)) | |
163 { | |
164 ReplacePlainString(tag, utf8Value); | |
165 } | |
166 } | |
167 | 162 |
168 void RemovePrivateTags() | 163 void RemovePrivateTags() |
169 { | 164 { |
170 RemovePrivateTagsInternal(NULL); | 165 RemovePrivateTagsInternal(NULL); |
171 } | 166 } |
232 unsigned int frameId); // IN | 227 unsigned int frameId); // IN |
233 | 228 |
234 unsigned int GetFramesCount() const; | 229 unsigned int GetFramesCount() const; |
235 | 230 |
236 static ParsedDicomFile* CreateFromJson(const Json::Value& value, | 231 static ParsedDicomFile* CreateFromJson(const Json::Value& value, |
237 DicomFromJsonFlags flags); | 232 DicomFromJsonFlags flags, |
233 const std::string& privateCreator); | |
238 | 234 |
239 void ChangeEncoding(Encoding target); | 235 void ChangeEncoding(Encoding target); |
240 | 236 |
241 void ExtractDicomSummary(DicomMap& target) const; | 237 void ExtractDicomSummary(DicomMap& target) const; |
242 | 238 |