Mercurial > hg > orthanc
annotate OrthancFramework/Sources/DicomFormat/DicomPath.h @ 4819:70d2a97ca8cb openssl-3.x
integration mainline->openssl-3.x
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 25 Nov 2021 13:12:32 +0100 |
parents | e17fdc43ef6c |
children | 7053502fbf97 |
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 #pragma once | |
24 | |
25 #include "../OrthancFramework.h" | |
26 #include "../DicomFormat/DicomTag.h" | |
27 | |
28 #include <vector> | |
29 | |
30 namespace Orthanc | |
31 { | |
4682
d38a7040474a
FromDcmtkBridge::RemovePath() and FromDcmtkBridge::ReplacePath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4681
diff
changeset
|
32 class ORTHANC_PUBLIC DicomPath |
4681 | 33 { |
34 private: | |
35 class PrefixItem | |
36 { | |
37 private: | |
38 DicomTag tag_; | |
39 bool isUniversal_; // Matches any index | |
40 size_t index_; | |
41 | |
42 PrefixItem(DicomTag tag, | |
43 bool isUniversal, | |
44 size_t index); | |
45 | |
46 public: | |
47 static PrefixItem CreateUniversal(const DicomTag& tag) | |
48 { | |
49 return PrefixItem(tag, true, 0 /* dummy value */); | |
50 } | |
51 | |
52 static PrefixItem CreateIndexed(const DicomTag& tag, | |
53 size_t index) | |
54 { | |
55 return PrefixItem(tag, false, index); | |
56 } | |
57 | |
58 const DicomTag& GetTag() const | |
59 { | |
60 return tag_; | |
61 } | |
62 | |
63 bool IsUniversal() const | |
64 { | |
65 return isUniversal_; | |
66 } | |
67 | |
68 size_t GetIndex() const; | |
4689
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4683
diff
changeset
|
69 |
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4683
diff
changeset
|
70 void SetIndex(size_t index); |
4681 | 71 }; |
72 | |
73 std::vector<PrefixItem> prefix_; | |
74 Orthanc::DicomTag finalTag_; | |
75 | |
76 static DicomTag ParseTag(const std::string& token); | |
77 | |
78 const PrefixItem& GetLevel(size_t i) const; | |
79 | |
80 public: | |
4690 | 81 explicit DicomPath(const Orthanc::DicomTag& tag); |
4681 | 82 |
83 DicomPath(const Orthanc::DicomTag& sequence, | |
84 size_t index, | |
85 const Orthanc::DicomTag& tag); | |
86 | |
87 DicomPath(const Orthanc::DicomTag& sequence1, | |
88 size_t index1, | |
89 const Orthanc::DicomTag& sequence2, | |
90 size_t index2, | |
91 const Orthanc::DicomTag& tag); | |
92 | |
93 DicomPath(const Orthanc::DicomTag& sequence1, | |
94 size_t index1, | |
95 const Orthanc::DicomTag& sequence2, | |
96 size_t index2, | |
97 const Orthanc::DicomTag& sequence3, | |
98 size_t index3, | |
99 const Orthanc::DicomTag& tag); | |
100 | |
4683
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
101 DicomPath(const std::vector<Orthanc::DicomTag>& parentTags, |
4690 | 102 const std::vector<size_t>& parentIndexes, |
4683
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
103 const Orthanc::DicomTag& finalTag); |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
104 |
4681 | 105 void AddIndexedTagToPrefix(const Orthanc::DicomTag& tag, |
106 size_t index); | |
107 | |
108 void AddUniversalTagToPrefix(const Orthanc::DicomTag& tag); | |
109 | |
4690 | 110 size_t GetPrefixLength() const; |
4681 | 111 |
4690 | 112 const Orthanc::DicomTag& GetFinalTag() const; |
4681 | 113 |
4690 | 114 const Orthanc::DicomTag& GetPrefixTag(size_t level) const; |
4681 | 115 |
4690 | 116 bool IsPrefixUniversal(size_t level) const; |
4681 | 117 |
4690 | 118 size_t GetPrefixIndex(size_t level) const; |
4681 | 119 |
4682
d38a7040474a
FromDcmtkBridge::RemovePath() and FromDcmtkBridge::ReplacePath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4681
diff
changeset
|
120 bool HasUniversal() const; |
d38a7040474a
FromDcmtkBridge::RemovePath() and FromDcmtkBridge::ReplacePath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4681
diff
changeset
|
121 |
4689
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4683
diff
changeset
|
122 // This method is used for an optimization in Stone |
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4683
diff
changeset
|
123 // (cf. "DicomStructureSet.cpp") |
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4683
diff
changeset
|
124 void SetPrefixIndex(size_t level, |
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4683
diff
changeset
|
125 size_t index); |
ead3b81f4541
added DicomPath::SetPrefixIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4683
diff
changeset
|
126 |
4681 | 127 std::string Format() const; |
128 | |
4682
d38a7040474a
FromDcmtkBridge::RemovePath() and FromDcmtkBridge::ReplacePath()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4681
diff
changeset
|
129 static DicomPath Parse(const std::string& s); |
4683
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
130 |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
131 static bool IsMatch(const DicomPath& pattern, |
7182f5732480
use of DicomPath in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4682
diff
changeset
|
132 const DicomPath& path); |
4735
e17fdc43ef6c
optimized version of DicomPath::IsMatch()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4690
diff
changeset
|
133 |
e17fdc43ef6c
optimized version of DicomPath::IsMatch()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4690
diff
changeset
|
134 static bool IsMatch(const DicomPath& pattern, |
e17fdc43ef6c
optimized version of DicomPath::IsMatch()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4690
diff
changeset
|
135 const std::vector<Orthanc::DicomTag>& prefixTags, |
e17fdc43ef6c
optimized version of DicomPath::IsMatch()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4690
diff
changeset
|
136 const std::vector<size_t>& prefixIndexes, |
e17fdc43ef6c
optimized version of DicomPath::IsMatch()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4690
diff
changeset
|
137 const DicomTag& finalTag); |
4681 | 138 }; |
139 } |