Mercurial > hg > orthanc
annotate OrthancFramework/Sources/DicomFormat/DicomPath.cpp @ 4706:dbee8bd8ee1f
display OpenSSL version in the logs
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 22 Jun 2021 09:13:03 +0200 |
parents | 13efc0967cea |
children | e17fdc43ef6c |
rev | line source |
---|---|
4681 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium | |
6 * | |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Lesser General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Lesser General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Lesser General Public | |
18 * License along with this program. If not, see | |
19 * <http://www.gnu.org/licenses/>. | |
20 **/ | |
21 | |
22 | |
23 #include "../PrecompiledHeaders.h" | |
24 #include "DicomPath.h" | |
25 | |
26 | |
27 #if !defined(ORTHANC_ENABLE_DCMTK) | |
28 # error Macro ORTHANC_ENABLE_DCMTK must be defined | |
29 #endif | |
30 | |
31 #if ORTHANC_ENABLE_DCMTK == 1 | |
32 # include "../DicomParsing/FromDcmtkBridge.h" | |
33 #endif | |
34 | |
35 #include "../OrthancException.h" | |
36 #include "../Toolbox.h" | |
37 | |
38 #include <boost/lexical_cast.hpp> | |
39 | |
40 | |
41 namespace Orthanc | |
42 { | |
43 DicomPath::PrefixItem::PrefixItem(DicomTag tag, | |
44 bool isUniversal, | |
45 size_t index) : | |
46 tag_(tag), | |
47 isUniversal_(isUniversal), | |
48 index_(index) | |
49 { | |
50 } | |
51 | |
52 | |
53 size_t DicomPath::PrefixItem::GetIndex() const | |
54 { | |
55 if (isUniversal_) | |
56 { | |
57 throw OrthancException(ErrorCode_BadSequenceOfCalls); | |
58 } | |
59 else | |
60 { | |
61 return index_; | |
62 } | |
63 } | |
64 | |
65 | |
4689
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4685
diff
changeset
|
66 void DicomPath::PrefixItem::SetIndex(size_t index) |
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4685
diff
changeset
|
67 { |
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4685
diff
changeset
|
68 isUniversal_ = false; |
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4685
diff
changeset
|
69 index_ = index; |
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4685
diff
changeset
|
70 } |
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4685
diff
changeset
|
71 |
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4685
diff
changeset
|
72 |
4681 | 73 DicomTag DicomPath::ParseTag(const std::string& token) |
74 { | |
75 DicomTag tag(0,0); | |
76 | |
77 if (token[0] == '(' && | |
78 token[token.size() - 1] == ')') | |
79 { | |
80 std::string hex = token.substr(1, token.size() - 2); | |
81 if (!DicomTag::ParseHexadecimal(tag, hex.c_str())) | |
82 { | |
83 throw OrthancException(ErrorCode_UnknownDicomTag, "Cannot parse tag: " + token); | |
84 } | |
85 } | |
86 else | |
87 { | |
88 #if ORTHANC_ENABLE_DCMTK == 1 | |
89 tag = FromDcmtkBridge::ParseTag(token); | |
90 #else | |
91 if (!DicomTag::ParseHexadecimal(tag, token.c_str())) | |
92 { | |
93 throw OrthancException(ErrorCode_UnknownDicomTag, "Cannot parse tag without DCMTK: " + token); | |
94 } | |
95 #endif | |
96 } | |
97 | |
98 return tag; | |
99 } | |
100 | |
101 | |
102 const DicomPath::PrefixItem& DicomPath::GetLevel(size_t i) const | |
103 { | |
104 if (i >= prefix_.size()) | |
105 { | |
106 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
107 } | |
108 else | |
109 { | |
110 return prefix_[i]; | |
111 } | |
112 } | |
113 | |
114 | |
4690 | 115 DicomPath::DicomPath(const Orthanc::DicomTag& tag) : |
116 finalTag_(tag) | |
117 { | |
118 } | |
119 | |
120 | |
4681 | 121 DicomPath::DicomPath(const Orthanc::DicomTag& sequence, |
122 size_t index, | |
123 const Orthanc::DicomTag& tag) : | |
124 finalTag_(tag) | |
125 { | |
126 AddIndexedTagToPrefix(sequence, index); | |
127 } | |
128 | |
129 | |
130 DicomPath::DicomPath(const Orthanc::DicomTag& sequence1, | |
131 size_t index1, | |
132 const Orthanc::DicomTag& sequence2, | |
133 size_t index2, | |
134 const Orthanc::DicomTag& tag) : | |
135 finalTag_(tag) | |
136 { | |
137 AddIndexedTagToPrefix(sequence1, index1); | |
138 AddIndexedTagToPrefix(sequence2, index2); | |
139 } | |
140 | |
141 | |
142 DicomPath::DicomPath(const Orthanc::DicomTag& sequence1, | |
143 size_t index1, | |
144 const Orthanc::DicomTag& sequence2, | |
145 size_t index2, | |
146 const Orthanc::DicomTag& sequence3, | |
147 size_t index3, | |
148 const Orthanc::DicomTag& tag) : | |
149 finalTag_(tag) | |
150 { | |
151 AddIndexedTagToPrefix(sequence1, index1); | |
152 AddIndexedTagToPrefix(sequence2, index2); | |
153 AddIndexedTagToPrefix(sequence3, index3); | |
154 } | |
155 | |
156 | |
4683
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
157 DicomPath::DicomPath(const std::vector<Orthanc::DicomTag>& parentTags, |
4690 | 158 const std::vector<size_t>& parentIndexes, |
4683
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
159 const Orthanc::DicomTag& finalTag) : |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
160 finalTag_(finalTag) |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
161 { |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
162 if (parentTags.size() != parentIndexes.size()) |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
163 { |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
164 throw OrthancException(ErrorCode_ParameterOutOfRange); |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
165 } |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
166 else |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
167 { |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
168 prefix_.reserve(parentTags.size()); |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
169 |
4685
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4683
diff
changeset
|
170 for (size_t i = 0; i < parentTags.size(); i++) |
4683
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
171 { |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
172 prefix_.push_back(PrefixItem::CreateIndexed(parentTags[i], parentIndexes[i])); |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
173 } |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
174 } |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
175 } |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
176 |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
177 |
4681 | 178 void DicomPath::AddIndexedTagToPrefix(const Orthanc::DicomTag& tag, |
179 size_t index) | |
180 { | |
181 prefix_.push_back(PrefixItem::CreateIndexed(tag, index)); | |
182 } | |
183 | |
184 | |
185 void DicomPath::AddUniversalTagToPrefix(const Orthanc::DicomTag& tag) | |
186 { | |
187 prefix_.push_back(PrefixItem::CreateUniversal(tag)); | |
188 } | |
189 | |
190 | |
4690 | 191 size_t DicomPath::GetPrefixLength() const |
192 { | |
193 return prefix_.size(); | |
194 } | |
195 | |
196 | |
197 const Orthanc::DicomTag& DicomPath::GetFinalTag() const | |
198 { | |
199 return finalTag_; | |
200 } | |
201 | |
202 | |
203 const Orthanc::DicomTag& DicomPath::GetPrefixTag(size_t level) const | |
204 { | |
205 return GetLevel(level).GetTag(); | |
206 } | |
207 | |
208 | |
209 bool DicomPath::IsPrefixUniversal(size_t level) const | |
210 { | |
211 return GetLevel(level).IsUniversal(); | |
212 } | |
213 | |
214 | |
215 size_t DicomPath::GetPrefixIndex(size_t level) const | |
216 { | |
217 return GetLevel(level).GetIndex(); | |
218 } | |
219 | |
220 | |
4682
d38a7040474a
FromDcmtkBridge::RemovePath() and FromDcmtkBridge::ReplacePath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4681
diff
changeset
|
221 bool DicomPath::HasUniversal() const |
d38a7040474a
FromDcmtkBridge::RemovePath() and FromDcmtkBridge::ReplacePath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4681
diff
changeset
|
222 { |
d38a7040474a
FromDcmtkBridge::RemovePath() and FromDcmtkBridge::ReplacePath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4681
diff
changeset
|
223 for (size_t i = 0; i < prefix_.size(); i++) |
d38a7040474a
FromDcmtkBridge::RemovePath() and FromDcmtkBridge::ReplacePath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4681
diff
changeset
|
224 { |
d38a7040474a
FromDcmtkBridge::RemovePath() and FromDcmtkBridge::ReplacePath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4681
diff
changeset
|
225 if (prefix_[i].IsUniversal()) |
d38a7040474a
FromDcmtkBridge::RemovePath() and FromDcmtkBridge::ReplacePath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4681
diff
changeset
|
226 { |
d38a7040474a
FromDcmtkBridge::RemovePath() and FromDcmtkBridge::ReplacePath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4681
diff
changeset
|
227 return true; |
d38a7040474a
FromDcmtkBridge::RemovePath() and FromDcmtkBridge::ReplacePath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4681
diff
changeset
|
228 } |
d38a7040474a
FromDcmtkBridge::RemovePath() and FromDcmtkBridge::ReplacePath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4681
diff
changeset
|
229 } |
d38a7040474a
FromDcmtkBridge::RemovePath() and FromDcmtkBridge::ReplacePath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4681
diff
changeset
|
230 |
d38a7040474a
FromDcmtkBridge::RemovePath() and FromDcmtkBridge::ReplacePath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4681
diff
changeset
|
231 return false; |
d38a7040474a
FromDcmtkBridge::RemovePath() and FromDcmtkBridge::ReplacePath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4681
diff
changeset
|
232 } |
d38a7040474a
FromDcmtkBridge::RemovePath() and FromDcmtkBridge::ReplacePath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4681
diff
changeset
|
233 |
d38a7040474a
FromDcmtkBridge::RemovePath() and FromDcmtkBridge::ReplacePath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4681
diff
changeset
|
234 |
4689
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4685
diff
changeset
|
235 void DicomPath::SetPrefixIndex(size_t level, |
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4685
diff
changeset
|
236 size_t index) |
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4685
diff
changeset
|
237 { |
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4685
diff
changeset
|
238 if (level >= prefix_.size()) |
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4685
diff
changeset
|
239 { |
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4685
diff
changeset
|
240 throw OrthancException(ErrorCode_ParameterOutOfRange); |
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4685
diff
changeset
|
241 } |
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4685
diff
changeset
|
242 else |
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4685
diff
changeset
|
243 { |
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4685
diff
changeset
|
244 prefix_[level].SetIndex(index); |
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4685
diff
changeset
|
245 } |
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4685
diff
changeset
|
246 } |
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4685
diff
changeset
|
247 |
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4685
diff
changeset
|
248 |
4681 | 249 std::string DicomPath::Format() const |
250 { | |
251 std::string s; | |
252 | |
253 for (size_t i = 0; i < prefix_.size(); i++) | |
254 { | |
255 s += "(" + prefix_[i].GetTag().Format() + ")"; | |
256 | |
257 if (prefix_[i].IsUniversal()) | |
258 { | |
259 s += "[*]."; | |
260 } | |
261 else | |
262 { | |
263 s += "[" + boost::lexical_cast<std::string>(prefix_[i].GetIndex()) + "]."; | |
264 } | |
265 } | |
266 | |
267 return s + "(" + finalTag_.Format() + ")"; | |
268 } | |
269 | |
270 | |
4682
d38a7040474a
FromDcmtkBridge::RemovePath() and FromDcmtkBridge::ReplacePath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4681
diff
changeset
|
271 DicomPath DicomPath::Parse(const std::string& s) |
4681 | 272 { |
273 std::vector<std::string> tokens; | |
274 Toolbox::TokenizeString(tokens, s, '.'); | |
275 | |
276 if (tokens.empty()) | |
277 { | |
278 throw OrthancException(ErrorCode_ParameterOutOfRange, "Empty path to DICOM tags"); | |
279 } | |
280 | |
281 const DicomTag finalTag = ParseTag(Toolbox::StripSpaces(tokens[tokens.size() - 1])); | |
282 | |
283 DicomPath path(finalTag); | |
284 | |
285 for (size_t i = 0; i < tokens.size() - 1; i++) | |
286 { | |
287 size_t pos = tokens[i].find('['); | |
288 if (pos == std::string::npos) | |
289 { | |
290 throw OrthancException(ErrorCode_ParameterOutOfRange, "Parent path doesn't contain an index"); | |
291 } | |
292 else | |
293 { | |
294 const std::string left = Orthanc::Toolbox::StripSpaces(tokens[i].substr(0, pos)); | |
295 const std::string right = Orthanc::Toolbox::StripSpaces(tokens[i].substr(pos + 1)); | |
296 | |
297 if (left.empty()) | |
298 { | |
299 throw OrthancException(ErrorCode_ParameterOutOfRange, "Parent path doesn't contain a tag"); | |
300 } | |
301 else if (right.empty() || | |
302 right[right.size() - 1] != ']') | |
303 { | |
304 throw OrthancException(ErrorCode_ParameterOutOfRange, "Parent path doesn't contain the end of the index"); | |
305 } | |
306 else | |
307 { | |
308 DicomTag tag = ParseTag(left); | |
309 | |
310 try | |
311 { | |
4690 | 312 std::string t = Toolbox::StripSpaces(right.substr(0, right.size() - 1)); |
313 if (t == "*") | |
4681 | 314 { |
4682
d38a7040474a
FromDcmtkBridge::RemovePath() and FromDcmtkBridge::ReplacePath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4681
diff
changeset
|
315 path.AddUniversalTagToPrefix(tag); |
4681 | 316 } |
317 else | |
318 { | |
4690 | 319 int index = boost::lexical_cast<int>(t); |
4681 | 320 if (index < 0) |
321 { | |
4690 | 322 throw OrthancException(ErrorCode_ParameterOutOfRange, "Negative index in parent path: " + t); |
4681 | 323 } |
324 else | |
325 { | |
326 path.AddIndexedTagToPrefix(tag, static_cast<size_t>(index)); | |
327 } | |
328 } | |
329 } | |
330 catch (boost::bad_lexical_cast&) | |
331 { | |
332 throw OrthancException(ErrorCode_ParameterOutOfRange, "Not a valid index in parent path: [" + right); | |
333 } | |
334 } | |
335 } | |
336 } | |
337 | |
338 return path; | |
339 } | |
4683
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
340 |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
341 |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
342 bool DicomPath::IsMatch(const DicomPath& pattern, |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
343 const DicomPath& path) |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
344 { |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
345 if (path.HasUniversal()) |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
346 { |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
347 throw OrthancException(ErrorCode_BadParameterType); |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
348 } |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
349 else if (path.GetPrefixLength() < pattern.GetPrefixLength()) |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
350 { |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
351 return false; |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
352 } |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
353 else |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
354 { |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
355 for (size_t i = 0; i < pattern.GetPrefixLength(); i++) |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
356 { |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
357 if (path.GetPrefixTag(i) != pattern.GetPrefixTag(i) || |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
358 (!pattern.IsPrefixUniversal(i) && |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
359 path.GetPrefixIndex(i) != pattern.GetPrefixIndex(i))) |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
360 { |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
361 return false; |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
362 } |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
363 } |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
364 |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
365 if (path.GetPrefixLength() == pattern.GetPrefixLength()) |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
366 { |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
367 return (path.GetFinalTag() == pattern.GetFinalTag()); |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
368 } |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
369 else |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
370 { |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
371 return (path.GetPrefixTag(pattern.GetPrefixLength()) == pattern.GetFinalTag()); |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
372 } |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
373 } |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
374 } |
4681 | 375 } |