annotate OrthancFramework/Sources/DicomFormat/DicomPath.cpp @ 4685:693f049729ba

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