Mercurial > hg > orthanc
annotate OrthancServer/Search/LookupResource.cpp @ 1758:318c2e83c2bd db-changes
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 28 Oct 2015 12:53:45 +0100 |
parents | 03b030680e3d |
children | 91a5d39ec665 |
rev | line source |
---|---|
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 * |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * This program is free software: you can redistribute it and/or |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * modify it under the terms of the GNU General Public License as |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * published by the Free Software Foundation, either version 3 of the |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * License, or (at your option) any later version. |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * In addition, as a special exception, the copyright holders of this |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * program give permission to link the code of its release with the |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * that use the same license as the "OpenSSL" library), and distribute |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * the linked executables. You must obey the GNU General Public License |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * in all respects for all of the code used other than "OpenSSL". If you |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * modify file(s) with this exception, you may extend this exception to |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * your version of the file(s), but you are not obligated to do so. If |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * you do not wish to do so, delete this exception statement from your |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 * version. If you delete this exception statement from all source files |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 * in the program, then also delete it here. |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 * |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 * This program is distributed in the hope that it will be useful, but |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 * WITHOUT ANY WARRANTY; without even the implied warranty of |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 * General Public License for more details. |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 * |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 * You should have received a copy of the GNU General Public License |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 **/ |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 #include "../PrecompiledHeadersServer.h" |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 #include "LookupResource.h" |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 |
1751
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
36 #include "ListConstraint.h" |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
37 #include "RangeConstraint.h" |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
38 #include "ValueConstraint.h" |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
39 #include "WildcardConstraint.h" |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
40 |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 #include "../../Core/OrthancException.h" |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
42 #include "../../Core/FileStorage/StorageAccessor.h" |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
43 #include "../ServerToolbox.h" |
1751
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
44 #include "../FromDcmtkBridge.h" |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
45 |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 namespace Orthanc |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 { |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
49 LookupResource::Level::Level(ResourceType level) : level_(level) |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 { |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 const DicomTag* tags = NULL; |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 size_t size; |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 LookupIdentifierQuery::LoadIdentifiers(tags, size, level); |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 for (size_t i = 0; i < size; i++) |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 { |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 identifiers_.insert(tags[i]); |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 } |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 DicomMap::LoadMainDicomTags(tags, size, level); |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 for (size_t i = 0; i < size; i++) |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 { |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 if (identifiers_.find(tags[i]) == identifiers_.end()) |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 { |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 mainTags_.insert(tags[i]); |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 } |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 } |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 } |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 LookupResource::Level::~Level() |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 { |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 for (Constraints::iterator it = mainTagsConstraints_.begin(); |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 it != mainTagsConstraints_.end(); ++it) |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 { |
1756 | 77 delete it->second; |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 } |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 for (Constraints::iterator it = identifiersConstraints_.begin(); |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 it != identifiersConstraints_.end(); ++it) |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 { |
1756 | 83 delete it->second; |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 } |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 } |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 |
1756 | 87 bool LookupResource::Level::Add(const DicomTag& tag, |
88 std::auto_ptr<IFindConstraint>& constraint) | |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 { |
1756 | 90 if (identifiers_.find(tag) != identifiers_.end()) |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 { |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
92 if (level_ == ResourceType_Patient) |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
93 { |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
94 // The filters on the patient level must be cloned to the study level |
1756 | 95 identifiersConstraints_[tag] = constraint->Clone(); |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
96 } |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
97 else |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
98 { |
1756 | 99 identifiersConstraints_[tag] = constraint.release(); |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
100 } |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
101 |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 return true; |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 } |
1756 | 104 else if (mainTags_.find(tag) != mainTags_.end()) |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
105 { |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
106 if (level_ == ResourceType_Patient) |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
107 { |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
108 // The filters on the patient level must be cloned to the study level |
1756 | 109 mainTagsConstraints_[tag] = constraint->Clone(); |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
110 } |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
111 else |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
112 { |
1756 | 113 mainTagsConstraints_[tag] = constraint.release(); |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
114 } |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
115 |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
116 return true; |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
117 } |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
118 else |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
119 { |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 return false; |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
121 } |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
122 } |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
123 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
124 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
125 LookupResource::LookupResource(ResourceType level) : level_(level) |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
126 { |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
127 switch (level) |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
128 { |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
129 case ResourceType_Patient: |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
130 levels_[ResourceType_Patient] = new Level(ResourceType_Patient); |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
131 break; |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
132 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
133 case ResourceType_Study: |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
134 levels_[ResourceType_Study] = new Level(ResourceType_Study); |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
135 // Do not add "break" here |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
136 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
137 case ResourceType_Series: |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
138 levels_[ResourceType_Series] = new Level(ResourceType_Series); |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
139 // Do not add "break" here |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
140 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
141 case ResourceType_Instance: |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
142 levels_[ResourceType_Instance] = new Level(ResourceType_Instance); |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
143 break; |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
144 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
145 default: |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
146 throw OrthancException(ErrorCode_InternalError); |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
147 } |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
148 } |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
149 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
150 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
151 LookupResource::~LookupResource() |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
152 { |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
153 for (Levels::iterator it = levels_.begin(); |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
154 it != levels_.end(); ++it) |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
155 { |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
156 delete it->second; |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
157 } |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
158 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
159 for (Constraints::iterator it = unoptimizedConstraints_.begin(); |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
160 it != unoptimizedConstraints_.end(); ++it) |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
161 { |
1756 | 162 delete it->second; |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
163 } |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
164 } |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
165 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
166 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
167 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
168 bool LookupResource::AddInternal(ResourceType level, |
1756 | 169 const DicomTag& tag, |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
170 std::auto_ptr<IFindConstraint>& constraint) |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
171 { |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
172 Levels::iterator it = levels_.find(level); |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
173 if (it != levels_.end()) |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
174 { |
1756 | 175 if (it->second->Add(tag, constraint)) |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
176 { |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
177 return true; |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
178 } |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
179 } |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
180 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
181 return false; |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
182 } |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
183 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
184 |
1756 | 185 void LookupResource::Add(const DicomTag& tag, |
186 IFindConstraint* constraint) | |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
187 { |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
188 std::auto_ptr<IFindConstraint> c(constraint); |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
189 |
1756 | 190 if (!AddInternal(ResourceType_Patient, tag, c) && |
191 !AddInternal(ResourceType_Study, tag, c) && | |
192 !AddInternal(ResourceType_Series, tag, c) && | |
193 !AddInternal(ResourceType_Instance, tag, c)) | |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
194 { |
1756 | 195 unoptimizedConstraints_[tag] = c.release(); |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
196 } |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
197 } |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
198 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
199 |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
200 static bool Match(const DicomMap& tags, |
1756 | 201 const DicomTag& tag, |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
202 const IFindConstraint& constraint) |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
203 { |
1756 | 204 const DicomValue* value = tags.TestAndGetValue(tag); |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
205 |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
206 if (value == NULL || |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
207 value->IsNull() || |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
208 value->IsBinary()) |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
209 { |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
210 return false; |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
211 } |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
212 else |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
213 { |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
214 return constraint.Match(value->GetContent()); |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
215 } |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
216 } |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
217 |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
218 |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
219 void LookupResource::Level::Apply(SetOfResources& candidates, |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
220 IDatabaseWrapper& database) const |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
221 { |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
222 // First, use the indexed identifiers |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
223 LookupIdentifierQuery query(level_); |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
224 |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
225 for (Constraints::const_iterator it = identifiersConstraints_.begin(); |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
226 it != identifiersConstraints_.end(); ++it) |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
227 { |
1756 | 228 it->second->Setup(query, it->first); |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
229 } |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
230 |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
231 query.Apply(candidates, database); |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
232 |
1758 | 233 /*{ |
234 query.Print(std::cout); | |
235 std::list<int64_t> source; | |
236 candidates.Flatten(source); | |
237 printf("=> %d\n", source.size()); | |
238 }*/ | |
239 | |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
240 // Secondly, filter using the main DICOM tags |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
241 if (!identifiersConstraints_.empty() || |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
242 !mainTagsConstraints_.empty()) |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
243 { |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
244 std::list<int64_t> source; |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
245 candidates.Flatten(source); |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
246 candidates.Clear(); |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
247 |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
248 std::list<int64_t> filtered; |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
249 for (std::list<int64_t>::const_iterator candidate = source.begin(); |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
250 candidate != source.end(); ++candidate) |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
251 { |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
252 DicomMap tags; |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
253 database.GetMainDicomTags(tags, *candidate); |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
254 |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
255 bool match = true; |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
256 |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
257 // Re-apply the identifier constraints, as their "Setup" |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
258 // method is less restrictive than their "Match" method |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
259 for (Constraints::const_iterator it = identifiersConstraints_.begin(); |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
260 match && it != identifiersConstraints_.end(); ++it) |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
261 { |
1756 | 262 if (!Match(tags, it->first, *it->second)) |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
263 { |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
264 match = false; |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
265 } |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
266 } |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
267 |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
268 for (Constraints::const_iterator it = mainTagsConstraints_.begin(); |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
269 match && it != mainTagsConstraints_.end(); ++it) |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
270 { |
1756 | 271 if (!Match(tags, it->first, *it->second)) |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
272 { |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
273 match = false; |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
274 } |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
275 } |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
276 |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
277 if (match) |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
278 { |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
279 filtered.push_back(*candidate); |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
280 } |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
281 } |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
282 |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
283 candidates.Intersect(filtered); |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
284 } |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
285 } |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
286 |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
287 |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
288 |
1753 | 289 bool LookupResource::IsMatch(const Json::Value& dicomAsJson) const |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
290 { |
1753 | 291 for (Constraints::const_iterator it = unoptimizedConstraints_.begin(); |
292 it != unoptimizedConstraints_.end(); ++it) | |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
293 { |
1756 | 294 std::string tag = it->first.Format(); |
1753 | 295 if (dicomAsJson.isMember(tag) && |
296 dicomAsJson[tag]["Type"] == "String") | |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
297 { |
1753 | 298 std::string value = dicomAsJson[tag]["Value"].asString(); |
1756 | 299 if (!it->second->Match(value)) |
1751
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
300 { |
1753 | 301 return false; |
1751
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
302 } |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
303 } |
1753 | 304 else |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
305 { |
1753 | 306 return false; |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
307 } |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
308 } |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
309 |
1753 | 310 return true; |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
311 } |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
312 |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
313 |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
314 void LookupResource::ApplyLevel(SetOfResources& candidates, |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
315 ResourceType level, |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
316 IDatabaseWrapper& database) const |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
317 { |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
318 Levels::const_iterator it = levels_.find(level); |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
319 if (it != levels_.end()) |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
320 { |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
321 it->second->Apply(candidates, database); |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
322 } |
1755
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
323 |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
324 if (level == ResourceType_Study && |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
325 modalitiesInStudy_.get() != NULL) |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
326 { |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
327 // There is a constraint on the "ModalitiesInStudy" DICOM |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
328 // extension. Check out whether one child series has one of the |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
329 // allowed modalities |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
330 std::list<int64_t> allStudies, matchingStudies; |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
331 candidates.Flatten(allStudies); |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
332 |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
333 for (std::list<int64_t>::const_iterator |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
334 study = allStudies.begin(); study != allStudies.end(); ++study) |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
335 { |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
336 std::list<int64_t> childrenSeries; |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
337 database.GetChildrenInternalId(childrenSeries, *study); |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
338 |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
339 for (std::list<int64_t>::const_iterator |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
340 series = childrenSeries.begin(); series != childrenSeries.end(); ++series) |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
341 { |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
342 DicomMap tags; |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
343 database.GetMainDicomTags(tags, *series); |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
344 |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
345 const DicomValue* value = tags.TestAndGetValue(DICOM_TAG_MODALITY); |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
346 if (value != NULL && |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
347 !value->IsNull() && |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
348 !value->IsBinary()) |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
349 { |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
350 if (modalitiesInStudy_->Match(value->GetContent())) |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
351 { |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
352 matchingStudies.push_back(*study); |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
353 break; |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
354 } |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
355 } |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
356 } |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
357 } |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
358 |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
359 candidates.Intersect(matchingStudies); |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
360 } |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
361 } |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
362 |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
363 |
1753 | 364 void LookupResource::FindCandidates(std::list<int64_t>& result, |
365 IDatabaseWrapper& database) const | |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
366 { |
1754 | 367 ResourceType startingLevel; |
368 if (level_ == ResourceType_Patient) | |
369 { | |
370 startingLevel = ResourceType_Patient; | |
371 } | |
372 else | |
373 { | |
374 startingLevel = ResourceType_Study; | |
375 } | |
376 | |
377 SetOfResources candidates(database, startingLevel); | |
1751
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
378 |
1753 | 379 switch (level_) |
1751
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
380 { |
1753 | 381 case ResourceType_Patient: |
382 ApplyLevel(candidates, ResourceType_Patient, database); | |
383 break; | |
1751
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
384 |
1753 | 385 case ResourceType_Study: |
386 ApplyLevel(candidates, ResourceType_Study, database); | |
387 break; | |
1751
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
388 |
1753 | 389 case ResourceType_Series: |
390 ApplyLevel(candidates, ResourceType_Study, database); | |
391 candidates.GoDown(); | |
392 ApplyLevel(candidates, ResourceType_Series, database); | |
393 break; | |
1751
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
394 |
1753 | 395 case ResourceType_Instance: |
396 ApplyLevel(candidates, ResourceType_Study, database); | |
397 candidates.GoDown(); | |
398 ApplyLevel(candidates, ResourceType_Series, database); | |
399 candidates.GoDown(); | |
400 ApplyLevel(candidates, ResourceType_Instance, database); | |
401 break; | |
1751
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
402 |
1753 | 403 default: |
404 throw OrthancException(ErrorCode_InternalError); | |
1751
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
405 } |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
406 |
1753 | 407 candidates.Flatten(result); |
1751
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
408 } |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
409 |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
410 |
1755
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
411 void LookupResource::SetModalitiesInStudy(const std::string& modalities) |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
412 { |
1756 | 413 modalitiesInStudy_.reset(new ListConstraint(true /* case sensitive */)); |
1755
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
414 |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
415 std::vector<std::string> items; |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
416 Toolbox::TokenizeString(items, modalities, '\\'); |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
417 |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
418 for (size_t i = 0; i < items.size(); i++) |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
419 { |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
420 modalitiesInStudy_->AddAllowedValue(items[i]); |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
421 } |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
422 } |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
423 |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
424 |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
425 void LookupResource::AddDicomConstraint(const DicomTag& tag, |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
426 const std::string& dicomQuery, |
1758 | 427 bool caseSensitive) |
1751
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
428 { |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
429 ValueRepresentation vr = FromDcmtkBridge::GetValueRepresentation(tag); |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
430 |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
431 // http://www.itk.org/Wiki/DICOM_QueryRetrieve_Explained |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
432 // http://dicomiseasy.blogspot.be/2012/01/dicom-queryretrieve-part-i.html |
1755
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
433 if (tag == DICOM_TAG_MODALITIES_IN_STUDY) |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
434 { |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
435 SetModalitiesInStudy(dicomQuery); |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
436 } |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
437 else if ((vr == ValueRepresentation_Date || |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
438 vr == ValueRepresentation_DateTime || |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
439 vr == ValueRepresentation_Time) && |
39c37a994b2f
handling of DICOM_TAG_MODALITIES_IN_STUDY
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1754
diff
changeset
|
440 dicomQuery.find('-') != std::string::npos) |
1751
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
441 { |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
442 /** |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
443 * Range matching is only defined for TM, DA and DT value |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
444 * representations. This code fixes issues 35 and 37. |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
445 * |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
446 * Reference: "Range matching is not defined for types of |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
447 * Attributes other than dates and times", DICOM PS 3.4, |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
448 * C.2.2.2.5 ("Range Matching"). |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
449 **/ |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
450 size_t separator = dicomQuery.find('-'); |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
451 std::string lower = dicomQuery.substr(0, separator); |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
452 std::string upper = dicomQuery.substr(separator + 1); |
1758 | 453 Add(tag, new RangeConstraint(lower, upper, caseSensitive)); |
1751
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
454 } |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
455 else if (dicomQuery.find('\\') != std::string::npos) |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
456 { |
1758 | 457 std::auto_ptr<ListConstraint> constraint(new ListConstraint(caseSensitive)); |
1751
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
458 |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
459 std::vector<std::string> items; |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
460 Toolbox::TokenizeString(items, dicomQuery, '\\'); |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
461 |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
462 for (size_t i = 0; i < items.size(); i++) |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
463 { |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
464 constraint->AddAllowedValue(items[i]); |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
465 } |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
466 |
1756 | 467 Add(tag, constraint.release()); |
1751
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
468 } |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
469 else if (dicomQuery.find('*') != std::string::npos || |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
470 dicomQuery.find('?') != std::string::npos) |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
471 { |
1758 | 472 Add(tag, new WildcardConstraint(dicomQuery, caseSensitive)); |
1751
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
473 } |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
474 else |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
475 { |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
476 /** |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
477 * Case-insensitive match for PN value representation (Patient |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
478 * Name). Case-senstive match for all the other value |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
479 * representations. |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
480 * |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
481 * Reference: DICOM PS 3.4 |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
482 * - C.2.2.2.1 ("Single Value Matching") |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
483 * - C.2.2.2.4 ("Wild Card Matching") |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
484 * http://medical.nema.org/Dicom/2011/11_04pu.pdf |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
485 * |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
486 * "Except for Attributes with a PN Value Representation, only |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
487 * entities with values which match exactly the value specified in the |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
488 * request shall match. This matching is case-sensitive, i.e., |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
489 * sensitive to the exact encoding of the key attribute value in |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
490 * character sets where a letter may have multiple encodings (e.g., |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
491 * based on its case, its position in a word, or whether it is |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
492 * accented) |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
493 * |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
494 * For Attributes with a PN Value Representation (e.g., Patient Name |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
495 * (0010,0010)), an application may perform literal matching that is |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
496 * either case-sensitive, or that is insensitive to some or all |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
497 * aspects of case, position, accent, or other character encoding |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
498 * variants." |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
499 * |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
500 * (0008,0018) UI SOPInstanceUID => Case-sensitive |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
501 * (0008,0050) SH AccessionNumber => Case-sensitive |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
502 * (0010,0020) LO PatientID => Case-sensitive |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
503 * (0020,000D) UI StudyInstanceUID => Case-sensitive |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
504 * (0020,000E) UI SeriesInstanceUID => Case-sensitive |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
505 **/ |
fb569ee09a69
LookupResource complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1750
diff
changeset
|
506 |
1758 | 507 Add(tag, new ValueConstraint(dicomQuery, caseSensitive)); |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
508 } |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1749
diff
changeset
|
509 } |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
510 } |