Mercurial > hg > orthanc
annotate OrthancServer/Sources/OrthancFindRequestHandler.cpp @ 5854:65f8c6dfba50 find-refactoring
cleanup
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Mon, 04 Nov 2024 17:51:46 +0100 |
parents | 58c549b881ae |
children | d1dea8ad74a6 |
rev | line source |
---|---|
565
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
5640
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5639
diff
changeset
|
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5639
diff
changeset
|
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium |
5485
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5432
diff
changeset
|
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
565
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * |
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * This program is free software: you can redistribute it and/or |
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * modify it under the terms of the GNU General Public License as |
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * published by the Free Software Foundation, either version 3 of the |
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * License, or (at your option) any later version. |
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * |
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * This program is distributed in the hope that it will be useful, but |
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * WITHOUT ANY WARRANTY; without even the implied warranty of |
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * General Public License for more details. |
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * |
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * You should have received a copy of the GNU General Public License |
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 **/ |
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
824
a811bdf8b8eb
precompiled headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
810
diff
changeset
|
23 |
831
84513f2ee1f3
pch for unit tests and server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
24 #include "PrecompiledHeadersServer.h" |
565
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 #include "OrthancFindRequestHandler.h" |
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 |
4045 | 27 #include "../../OrthancFramework/Sources/DicomFormat/DicomArray.h" |
28 #include "../../OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h" | |
29 #include "../../OrthancFramework/Sources/Logging.h" | |
30 #include "../../OrthancFramework/Sources/Lua/LuaFunctionCall.h" | |
31 #include "../../OrthancFramework/Sources/MetricsRegistry.h" | |
2940
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2892
diff
changeset
|
32 #include "OrthancConfiguration.h" |
5696
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
33 #include "ResourceFinder.cpp" |
3094
61da3c9b4121
cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3061
diff
changeset
|
34 #include "Search/DatabaseLookup.h" |
3095
beeeb6096f27
removing dependencies upon ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3094
diff
changeset
|
35 #include "ServerContext.h" |
1759
e268412adcf1
removal of old implementation of search
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1758
diff
changeset
|
36 #include "ServerToolbox.h" |
608 | 37 |
1486
f967bdf8534e
refactoring to Logging.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1429
diff
changeset
|
38 #include <boost/regex.hpp> |
f967bdf8534e
refactoring to Logging.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1429
diff
changeset
|
39 |
608 | 40 |
1361
94ffb597d297
refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1354
diff
changeset
|
41 namespace Orthanc |
94ffb597d297
refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1354
diff
changeset
|
42 { |
5698 | 43 static void CopySequence(ParsedDicomFile& dicom, |
44 const DicomTag& tag, | |
45 const Json::Value& source, | |
46 const std::string& defaultPrivateCreator, | |
47 const std::map<uint16_t, std::string>& privateCreators) | |
48 { | |
49 if (source.type() == Json::objectValue && | |
50 source.isMember("Type") && | |
51 source.isMember("Value") && | |
52 source["Type"].asString() == "Sequence" && | |
53 source["Value"].type() == Json::arrayValue) | |
54 { | |
55 Json::Value content = Json::arrayValue; | |
56 | |
57 for (Json::Value::ArrayIndex i = 0; i < source["Value"].size(); i++) | |
58 { | |
59 Json::Value item; | |
60 Toolbox::SimplifyDicomAsJson(item, source["Value"][i], DicomToJsonFormat_Short); | |
61 content.append(item); | |
62 } | |
63 | |
64 if (tag.IsPrivate()) | |
65 { | |
66 std::map<uint16_t, std::string>::const_iterator found = privateCreators.find(tag.GetGroup()); | |
67 | |
68 if (found != privateCreators.end()) | |
69 { | |
70 dicom.Replace(tag, content, false, DicomReplaceMode_InsertIfAbsent, found->second.c_str()); | |
71 } | |
72 else | |
73 { | |
74 dicom.Replace(tag, content, false, DicomReplaceMode_InsertIfAbsent, defaultPrivateCreator); | |
75 } | |
76 } | |
77 else | |
78 { | |
79 dicom.Replace(tag, content, false, DicomReplaceMode_InsertIfAbsent, "" /* no private creator */); | |
80 } | |
81 } | |
82 } | |
83 | |
84 | |
1851
d364926389e0
OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
85 bool OrthancFindRequestHandler::FilterQueryTag(std::string& value /* can be modified */, |
d364926389e0
OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
86 ResourceType level, |
d364926389e0
OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
87 const DicomTag& tag, |
d364926389e0
OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
88 ModalityManufacturer manufacturer) |
d364926389e0
OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
89 { |
2335 | 90 // Whatever the manufacturer, remove the GenericGroupLength tags |
91 // http://dicom.nema.org/medical/dicom/current/output/chtml/part05/sect_7.2.html | |
5432
59e3b6f8c5be
migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5222
diff
changeset
|
92 // https://orthanc.uclouvain.be/bugs/show_bug.cgi?id=31 |
2434
63194107e61b
fix issue 31 for good: removing group length correctly
amazy
parents:
2382
diff
changeset
|
93 if (tag.GetElement() == 0x0000) |
2317
5b7556568fa4
Incoming C-Find request: removing group-length for all manufacturer -> removed EFilm2 manufacturer that is now useless
amazy
parents:
2256
diff
changeset
|
94 { |
5b7556568fa4
Incoming C-Find request: removing group-length for all manufacturer -> removed EFilm2 manufacturer that is now useless
amazy
parents:
2256
diff
changeset
|
95 return false; |
5b7556568fa4
Incoming C-Find request: removing group-length for all manufacturer -> removed EFilm2 manufacturer that is now useless
amazy
parents:
2256
diff
changeset
|
96 } |
5b7556568fa4
Incoming C-Find request: removing group-length for all manufacturer -> removed EFilm2 manufacturer that is now useless
amazy
parents:
2256
diff
changeset
|
97 |
1853
b7d3d3b182cf
two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1851
diff
changeset
|
98 switch (manufacturer) |
b7d3d3b182cf
two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1851
diff
changeset
|
99 { |
b7d3d3b182cf
two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1851
diff
changeset
|
100 case ModalityManufacturer_Vitrea: |
b7d3d3b182cf
two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1851
diff
changeset
|
101 // Following Denis Nesterov's mail on 2015-11-30 |
b7d3d3b182cf
two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1851
diff
changeset
|
102 if (tag == DicomTag(0x5653, 0x0010)) // "PrivateCreator = Vital Images SW 3.4" |
b7d3d3b182cf
two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1851
diff
changeset
|
103 { |
b7d3d3b182cf
two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1851
diff
changeset
|
104 return false; |
b7d3d3b182cf
two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1851
diff
changeset
|
105 } |
b7d3d3b182cf
two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1851
diff
changeset
|
106 |
b7d3d3b182cf
two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1851
diff
changeset
|
107 break; |
b7d3d3b182cf
two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1851
diff
changeset
|
108 |
b7d3d3b182cf
two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1851
diff
changeset
|
109 default: |
b7d3d3b182cf
two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1851
diff
changeset
|
110 break; |
b7d3d3b182cf
two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1851
diff
changeset
|
111 } |
b7d3d3b182cf
two patches for manufacturers Efilm and Vitrea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1851
diff
changeset
|
112 |
1851
d364926389e0
OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
113 return true; |
d364926389e0
OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
114 } |
d364926389e0
OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
115 |
d364926389e0
OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
116 |
1888
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
117 bool OrthancFindRequestHandler::ApplyLuaFilter(DicomMap& target, |
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
118 const DicomMap& source, |
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
119 const std::string& remoteIp, |
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
120 const std::string& remoteAet, |
2827
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2617
diff
changeset
|
121 const std::string& calledAet, |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2617
diff
changeset
|
122 ModalityManufacturer manufacturer) |
1888
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
123 { |
2221
e7beca979562
fix Windows build due to overwriting a macro
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2218
diff
changeset
|
124 static const char* LUA_CALLBACK = "IncomingFindRequestFilter"; |
2616
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2612
diff
changeset
|
125 |
2617
912a767911b0
back to a single Lua context
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2616
diff
changeset
|
126 LuaScripting::Lock lock(context_.GetLuaScripting()); |
912a767911b0
back to a single Lua context
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2616
diff
changeset
|
127 |
2616
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2612
diff
changeset
|
128 if (!lock.GetLua().IsExistingFunction(LUA_CALLBACK)) |
2218
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2208
diff
changeset
|
129 { |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2208
diff
changeset
|
130 return false; |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2208
diff
changeset
|
131 } |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2208
diff
changeset
|
132 else |
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2208
diff
changeset
|
133 { |
2827
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2617
diff
changeset
|
134 Json::Value origin; |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2617
diff
changeset
|
135 FormatOrigin(origin, remoteIp, remoteAet, calledAet, manufacturer); |
1888
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
136 |
2616
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2612
diff
changeset
|
137 LuaFunctionCall call(lock.GetLua(), LUA_CALLBACK); |
2218
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2208
diff
changeset
|
138 call.PushDicom(source); |
1888
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
139 call.PushJson(origin); |
4105
c02a2d9efbc2
move FromDcmtkBridge::ExecuteToDicom() to LuaFunctionCall, to remove dependency of DCMTK on Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4055
diff
changeset
|
140 call.ExecuteToDicom(target); |
1888
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
141 |
2218
3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2208
diff
changeset
|
142 return true; |
1888
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
143 } |
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
144 } |
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
145 |
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
146 |
2616
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2612
diff
changeset
|
147 OrthancFindRequestHandler::OrthancFindRequestHandler(ServerContext& context) : |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2612
diff
changeset
|
148 context_(context), |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2612
diff
changeset
|
149 maxResults_(0), |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2612
diff
changeset
|
150 maxInstances_(0) |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2612
diff
changeset
|
151 { |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2612
diff
changeset
|
152 } |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2612
diff
changeset
|
153 |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2612
diff
changeset
|
154 |
5696
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
155 namespace |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
156 { |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
157 class LookupVisitorV2 : public ResourceFinder::IVisitor |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
158 { |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
159 private: |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
160 DicomFindAnswers& answers_; |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
161 DicomArray queryAsArray_; |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
162 const std::list<DicomTag>& sequencesToReturn_; |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
163 std::string defaultPrivateCreator_; // the private creator to use if the group is not defined in the query itself |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
164 const std::map<uint16_t, std::string>& privateCreators_; // the private creators defined in the query itself |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
165 std::string retrieveAet_; |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
166 |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
167 public: |
5700
1fab9ddaf702
webdav using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5699
diff
changeset
|
168 LookupVisitorV2(DicomFindAnswers& answers, |
5696
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
169 const DicomMap& query, |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
170 const std::list<DicomTag>& sequencesToReturn, |
5700
1fab9ddaf702
webdav using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5699
diff
changeset
|
171 const std::map<uint16_t, std::string>& privateCreators) : |
5696
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
172 answers_(answers), |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
173 queryAsArray_(query), |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
174 sequencesToReturn_(sequencesToReturn), |
5700
1fab9ddaf702
webdav using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5699
diff
changeset
|
175 privateCreators_(privateCreators) |
5696
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
176 { |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
177 answers_.SetComplete(false); |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
178 |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
179 { |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
180 OrthancConfiguration::ReaderLock lock; |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
181 defaultPrivateCreator_ = lock.GetConfiguration().GetDefaultPrivateCreator(); |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
182 retrieveAet_ = lock.GetConfiguration().GetOrthancAET(); |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
183 } |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
184 } |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
185 |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
186 virtual void Apply(const FindResponse::Resource& resource, |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
187 const DicomMap& requestedTags) ORTHANC_OVERRIDE |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
188 { |
5698 | 189 DicomMap resourceTags; |
190 resource.GetAllMainDicomTags(resourceTags); | |
191 resourceTags.Merge(requestedTags); | |
192 | |
193 DicomMap result; | |
5696
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
194 |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
195 /** |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
196 * Add the mandatory "Retrieve AE Title (0008,0054)" tag, which was missing in Orthanc <= 1.7.2. |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
197 * http://dicom.nema.org/medical/dicom/current/output/html/part04.html#sect_C.4.1.1.3.2 |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
198 * https://groups.google.com/g/orthanc-users/c/-7zNTKR_PMU/m/kfjwzEVNAgAJ |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
199 **/ |
5698 | 200 result.SetValue(DICOM_TAG_RETRIEVE_AE_TITLE, retrieveAet_, false /* not binary */); |
5696
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
201 |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
202 for (size_t i = 0; i < queryAsArray_.GetSize(); i++) |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
203 { |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
204 const DicomTag tag = queryAsArray_.GetElement(i).GetTag(); |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
205 |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
206 if (tag == DICOM_TAG_QUERY_RETRIEVE_LEVEL) |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
207 { |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
208 // Fix issue 30 on Google Code (QR response missing "Query/Retrieve Level" (008,0052)) |
5698 | 209 result.SetValue(tag, queryAsArray_.GetElement(i).GetValue()); |
5696
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
210 } |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
211 else if (tag == DICOM_TAG_SPECIFIC_CHARACTER_SET) |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
212 { |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
213 // Do not include the encoding, this is handled by class ParsedDicomFile |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
214 } |
5698 | 215 else |
5696
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
216 { |
5698 | 217 const DicomValue* value = resourceTags.TestAndGetValue(tag); |
218 | |
219 if (value == NULL || | |
220 value->IsNull() || | |
221 value->IsBinary()) | |
222 { | |
223 result.SetValue(tag, "", false); | |
224 } | |
225 else | |
226 { | |
227 result.SetValue(tag, value->GetContent(), false); | |
228 } | |
5696
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
229 } |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
230 } |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
231 |
5698 | 232 if (result.GetSize() == 0 && |
233 sequencesToReturn_.empty()) | |
234 { | |
235 CLOG(WARNING, DICOM) << "The C-FIND request does not return any DICOM tag"; | |
236 } | |
237 else if (sequencesToReturn_.empty()) | |
238 { | |
239 answers_.Add(result); | |
240 } | |
241 else | |
242 { | |
243 ParsedDicomFile dicom(result, GetDefaultDicomEncoding(), | |
244 true /* be permissive, cf. issue #136 */, defaultPrivateCreator_, privateCreators_); | |
245 | |
246 for (std::list<DicomTag>::const_iterator tag = sequencesToReturn_.begin(); | |
247 tag != sequencesToReturn_.end(); ++tag) | |
248 { | |
249 const DicomValue* value = resourceTags.TestAndGetValue(*tag); | |
250 if (value != NULL && | |
251 value->IsSequence()) | |
252 { | |
253 CopySequence(dicom, *tag, value->GetSequenceContent(), defaultPrivateCreator_, privateCreators_); | |
254 } | |
255 else | |
256 { | |
257 dicom.Replace(*tag, std::string(""), false, DicomReplaceMode_InsertIfAbsent, defaultPrivateCreator_); | |
258 } | |
259 } | |
260 | |
261 answers_.Add(dicom); | |
262 } | |
5696
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
263 } |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
264 |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
265 virtual void MarkAsComplete() ORTHANC_OVERRIDE |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
266 { |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
267 answers_.SetComplete(true); |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
268 } |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
269 }; |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
270 } |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
271 |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
272 |
1800
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1799
diff
changeset
|
273 void OrthancFindRequestHandler::Handle(DicomFindAnswers& answers, |
665 | 274 const DicomMap& input, |
1859
4e7c318a3f69
C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1856
diff
changeset
|
275 const std::list<DicomTag>& sequencesToReturn, |
1573
3309878b3e16
more information about the origin of requests submitted to the DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
276 const std::string& remoteIp, |
1799
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1759
diff
changeset
|
277 const std::string& remoteAet, |
2256
de1ba22fd28a
simplification wrt. modality manufacturers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
278 const std::string& calledAet, |
de1ba22fd28a
simplification wrt. modality manufacturers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
279 ModalityManufacturer manufacturer) |
565
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
280 { |
3174
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3163
diff
changeset
|
281 MetricsRegistry::Timer timer(context_.GetMetricsRegistry(), "orthanc_find_scp_duration_ms"); |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3163
diff
changeset
|
282 |
4482
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
283 |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
284 /** |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
285 * Deal with global configuration |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
286 **/ |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
287 |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
288 bool caseSensitivePN; |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
289 |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
290 { |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
291 OrthancConfiguration::ReaderLock lock; |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
292 caseSensitivePN = lock.GetConfiguration().GetBooleanParameter("CaseSensitivePN", false); |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
293 |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
294 RemoteModalityParameters remote; |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
295 if (!lock.GetConfiguration().LookupDicomModalityUsingAETitle(remote, remoteAet)) |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
296 { |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
297 if (lock.GetConfiguration().GetBooleanParameter("DicomAlwaysAllowFind", false)) |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
298 { |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
299 CLOG(INFO, DICOM) << "C-FIND: Allowing SCU request from unknown modality with AET: " << remoteAet; |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
300 } |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
301 else |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
302 { |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
303 // This should never happen, given the test at bottom of |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
304 // "OrthancApplicationEntityFilter::IsAllowedRequest()" |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
305 throw OrthancException(ErrorCode_InexistentItem, |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
306 "C-FIND: Rejecting SCU request from unknown modality with AET: " + remoteAet); |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
307 } |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
308 } |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
309 } |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
310 |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
311 |
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
312 |
565
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
313 /** |
1888
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
314 * Possibly apply the user-supplied Lua filter. |
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
315 **/ |
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
316 |
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
317 DicomMap lua; |
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
318 const DicomMap* filteredInput = &input; |
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
319 |
2827
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2617
diff
changeset
|
320 if (ApplyLuaFilter(lua, input, remoteIp, remoteAet, calledAet, manufacturer)) |
1888
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
321 { |
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
322 filteredInput = &lua; |
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
323 } |
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
324 |
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
325 |
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
326 /** |
565
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
327 * Retrieve the query level. |
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
328 **/ |
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
329 |
1888
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
330 assert(filteredInput != NULL); |
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
331 const DicomValue* levelTmp = filteredInput->TestAndGetValue(DICOM_TAG_QUERY_RETRIEVE_LEVEL); |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1582
diff
changeset
|
332 if (levelTmp == NULL || |
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1582
diff
changeset
|
333 levelTmp->IsNull() || |
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1582
diff
changeset
|
334 levelTmp->IsBinary()) |
565
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
335 { |
2955 | 336 throw OrthancException(ErrorCode_BadRequest, |
337 "C-FIND request without the tag 0008,0052 (QueryRetrieveLevel)"); | |
565
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
338 } |
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
339 |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1582
diff
changeset
|
340 ResourceType level = StringToResourceType(levelTmp->GetContent().c_str()); |
565
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
341 |
714
6a1dbba0cca7
new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
342 if (level != ResourceType_Patient && |
6a1dbba0cca7
new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
343 level != ResourceType_Study && |
6a1dbba0cca7
new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
344 level != ResourceType_Series && |
6a1dbba0cca7
new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
345 level != ResourceType_Instance) |
565
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
346 { |
714
6a1dbba0cca7
new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
347 throw OrthancException(ErrorCode_NotImplemented); |
6a1dbba0cca7
new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
348 } |
6a1dbba0cca7
new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
349 |
1888
512b6e76f531
Lua: "IncomingFindRequestFilter()" to apply filters to incoming C-Find requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
350 DicomArray query(*filteredInput); |
4287
5a3374b6e707
using CLOG in Orthanc DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
351 CLOG(INFO, DICOM) << "DICOM C-Find request at level: " << EnumerationToString(level); |
714
6a1dbba0cca7
new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
352 |
6a1dbba0cca7
new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
353 for (size_t i = 0; i < query.GetSize(); i++) |
6a1dbba0cca7
new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
354 { |
6a1dbba0cca7
new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
355 if (!query.GetElement(i).GetValue().IsNull()) |
6a1dbba0cca7
new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
356 { |
4313
91554aecff9a
removed a friend method for better abi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4287
diff
changeset
|
357 CLOG(INFO, DICOM) << " (" << query.GetElement(i).GetTag().Format() |
91554aecff9a
removed a friend method for better abi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4287
diff
changeset
|
358 << ") " << FromDcmtkBridge::GetTagName(query.GetElement(i)) |
4376
b002f9abe802
review of changeset 4375:208029732d51
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4375
diff
changeset
|
359 << " = " << context_.GetDeidentifiedContent(query.GetElement(i)); |
714
6a1dbba0cca7
new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
360 } |
565
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
361 } |
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
362 |
5696
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
363 std::set<DicomTag> requestedTags; |
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
364 |
1859
4e7c318a3f69
C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1856
diff
changeset
|
365 for (std::list<DicomTag>::const_iterator it = sequencesToReturn.begin(); |
4e7c318a3f69
C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1856
diff
changeset
|
366 it != sequencesToReturn.end(); ++it) |
4e7c318a3f69
C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1856
diff
changeset
|
367 { |
5696
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
368 requestedTags.insert(*it); |
4287
5a3374b6e707
using CLOG in Orthanc DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
369 CLOG(INFO, DICOM) << " (" << it->Format() |
5a3374b6e707
using CLOG in Orthanc DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
370 << ") " << FromDcmtkBridge::GetTagName(*it, "") |
5a3374b6e707
using CLOG in Orthanc DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
371 << " : sequence tag whose content will be copied"; |
1859
4e7c318a3f69
C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1856
diff
changeset
|
372 } |
4e7c318a3f69
C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1856
diff
changeset
|
373 |
4020
320cde762fd9
collect private creators from the C-Find query itself; use DefaultPrivateCreator otherwise
Alain Mazy <alain@mazy.be>
parents:
4011
diff
changeset
|
374 // collect the private creators from the query itself |
320cde762fd9
collect private creators from the C-Find query itself; use DefaultPrivateCreator otherwise
Alain Mazy <alain@mazy.be>
parents:
4011
diff
changeset
|
375 std::map<uint16_t, std::string> privateCreators; |
320cde762fd9
collect private creators from the C-Find query itself; use DefaultPrivateCreator otherwise
Alain Mazy <alain@mazy.be>
parents:
4011
diff
changeset
|
376 for (size_t i = 0; i < query.GetSize(); i++) |
320cde762fd9
collect private creators from the C-Find query itself; use DefaultPrivateCreator otherwise
Alain Mazy <alain@mazy.be>
parents:
4011
diff
changeset
|
377 { |
320cde762fd9
collect private creators from the C-Find query itself; use DefaultPrivateCreator otherwise
Alain Mazy <alain@mazy.be>
parents:
4011
diff
changeset
|
378 const DicomElement& element = query.GetElement(i); |
320cde762fd9
collect private creators from the C-Find query itself; use DefaultPrivateCreator otherwise
Alain Mazy <alain@mazy.be>
parents:
4011
diff
changeset
|
379 if (element.GetTag().IsPrivate() && element.GetTag().GetElement() == 0x10) |
320cde762fd9
collect private creators from the C-Find query itself; use DefaultPrivateCreator otherwise
Alain Mazy <alain@mazy.be>
parents:
4011
diff
changeset
|
380 { |
320cde762fd9
collect private creators from the C-Find query itself; use DefaultPrivateCreator otherwise
Alain Mazy <alain@mazy.be>
parents:
4011
diff
changeset
|
381 privateCreators[element.GetTag().GetGroup()] = element.GetValue().GetContent(); |
320cde762fd9
collect private creators from the C-Find query itself; use DefaultPrivateCreator otherwise
Alain Mazy <alain@mazy.be>
parents:
4011
diff
changeset
|
382 } |
320cde762fd9
collect private creators from the C-Find query itself; use DefaultPrivateCreator otherwise
Alain Mazy <alain@mazy.be>
parents:
4011
diff
changeset
|
383 } |
565
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
384 |
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
385 /** |
1361
94ffb597d297
refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1354
diff
changeset
|
386 * Build up the query object. |
608 | 387 **/ |
388 | |
3033
5da6d1063d8f
effectively replacing LookupResource by DatabaseLookup in searches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3025
diff
changeset
|
389 DatabaseLookup lookup; |
1759
e268412adcf1
removal of old implementation of search
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1758
diff
changeset
|
390 |
1361
94ffb597d297
refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1354
diff
changeset
|
391 for (size_t i = 0; i < query.GetSize(); i++) |
714
6a1dbba0cca7
new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
392 { |
2115
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2088
diff
changeset
|
393 const DicomElement& element = query.GetElement(i); |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2088
diff
changeset
|
394 const DicomTag tag = element.GetTag(); |
714
6a1dbba0cca7
new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
395 |
5639
b6a6179a2a69
TimezoneOffsetFromUTC is now ignored for C-Find matching
Alain Mazy <am@orthanc.team>
parents:
5485
diff
changeset
|
396 // remove tags that are not used for matching |
5699
e8e028aed89f
c-find tests pass using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5698
diff
changeset
|
397 if (tag == DICOM_TAG_QUERY_RETRIEVE_LEVEL || |
5639
b6a6179a2a69
TimezoneOffsetFromUTC is now ignored for C-Find matching
Alain Mazy <am@orthanc.team>
parents:
5485
diff
changeset
|
398 tag == DICOM_TAG_SPECIFIC_CHARACTER_SET || |
b6a6179a2a69
TimezoneOffsetFromUTC is now ignored for C-Find matching
Alain Mazy <am@orthanc.team>
parents:
5485
diff
changeset
|
399 tag == DICOM_TAG_TIMEZONE_OFFSET_FROM_UTC) // time zone is not directly used for matching. Once we support "Timezone query adjustment", we may use it to adjust date-time filters but for now, just ignore it |
714
6a1dbba0cca7
new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
400 { |
1361
94ffb597d297
refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1354
diff
changeset
|
401 continue; |
714
6a1dbba0cca7
new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
402 } |
6a1dbba0cca7
new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
403 |
5699
e8e028aed89f
c-find tests pass using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5698
diff
changeset
|
404 requestedTags.insert(tag); |
e8e028aed89f
c-find tests pass using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5698
diff
changeset
|
405 |
e8e028aed89f
c-find tests pass using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5698
diff
changeset
|
406 if (element.GetValue().IsNull()) |
e8e028aed89f
c-find tests pass using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5698
diff
changeset
|
407 { |
e8e028aed89f
c-find tests pass using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5698
diff
changeset
|
408 // There is no constraint on this tag |
e8e028aed89f
c-find tests pass using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5698
diff
changeset
|
409 continue; |
e8e028aed89f
c-find tests pass using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5698
diff
changeset
|
410 } |
e8e028aed89f
c-find tests pass using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5698
diff
changeset
|
411 |
2115
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2088
diff
changeset
|
412 std::string value = element.GetValue().GetContent(); |
1429
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1383
diff
changeset
|
413 if (value.size() == 0) |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1383
diff
changeset
|
414 { |
3163
cf91b6f22278
Fix issue #90 (C-Find shall match missing tags to null/empty string)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3095
diff
changeset
|
415 // An empty string corresponds to an universal constraint, so we ignore it |
5696
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
416 requestedTags.insert(tag); |
1429
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1383
diff
changeset
|
417 continue; |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1383
diff
changeset
|
418 } |
611
9924aec1d694
filtering on modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
610
diff
changeset
|
419 |
2256
de1ba22fd28a
simplification wrt. modality manufacturers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
420 if (FilterQueryTag(value, level, tag, manufacturer)) |
1851
d364926389e0
OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
421 { |
2006
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
422 ValueRepresentation vr = FromDcmtkBridge::LookupValueRepresentation(tag); |
1758 | 423 |
1851
d364926389e0
OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
424 // DICOM specifies that searches must be case sensitive, except |
d364926389e0
OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
425 // for tags with a PN value representation |
d364926389e0
OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
426 bool sensitive = true; |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2006
diff
changeset
|
427 if (vr == ValueRepresentation_PersonName) |
1851
d364926389e0
OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
428 { |
d364926389e0
OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
429 sensitive = caseSensitivePN; |
d364926389e0
OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
430 } |
d364926389e0
OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
431 |
3033
5da6d1063d8f
effectively replacing LookupResource by DatabaseLookup in searches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3025
diff
changeset
|
432 lookup.AddDicomConstraint(tag, value, sensitive, true /* mandatory */); |
1851
d364926389e0
OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
433 } |
d364926389e0
OrthancFindRequestHandler::FilterQueryTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
434 else |
1758 | 435 { |
4287
5a3374b6e707
using CLOG in Orthanc DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
436 CLOG(INFO, DICOM) << "Because of a patch for the manufacturer of the remote modality, " |
5a3374b6e707
using CLOG in Orthanc DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
437 << "ignoring constraint on tag (" << tag.Format() << ") " |
5a3374b6e707
using CLOG in Orthanc DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
438 << FromDcmtkBridge::GetTagName(element); |
1759
e268412adcf1
removal of old implementation of search
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1758
diff
changeset
|
439 } |
611
9924aec1d694
filtering on modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
610
diff
changeset
|
440 } |
9924aec1d694
filtering on modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
610
diff
changeset
|
441 |
1361
94ffb597d297
refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1354
diff
changeset
|
442 |
608 | 443 /** |
1361
94ffb597d297
refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1354
diff
changeset
|
444 * Run the query. |
565
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
445 **/ |
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
446 |
5833
58c549b881ae
merged find-refactoring -> find-refactoring-clean
Alain Mazy <am@orthanc.team>
diff
changeset
|
447 ResourceFinder finder(level, ResponseContentFlags_ID); |
5704
0c2f0d72d143
only keep experimental versions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5702
diff
changeset
|
448 finder.SetDatabaseLookup(lookup); |
0c2f0d72d143
only keep experimental versions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5702
diff
changeset
|
449 finder.AddRequestedTags(requestedTags); |
5696
0f8b6214308a
preparing to use ResourceFinder in OrthancFindRequestHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
450 |
5704
0c2f0d72d143
only keep experimental versions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5702
diff
changeset
|
451 LookupVisitorV2 visitor(answers, *filteredInput, sequencesToReturn, privateCreators); |
0c2f0d72d143
only keep experimental versions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5702
diff
changeset
|
452 finder.Execute(visitor, context_); |
565
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
453 } |
2827
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2617
diff
changeset
|
454 |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2617
diff
changeset
|
455 |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2617
diff
changeset
|
456 void OrthancFindRequestHandler::FormatOrigin(Json::Value& origin, |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2617
diff
changeset
|
457 const std::string& remoteIp, |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2617
diff
changeset
|
458 const std::string& remoteAet, |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2617
diff
changeset
|
459 const std::string& calledAet, |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2617
diff
changeset
|
460 ModalityManufacturer manufacturer) |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2617
diff
changeset
|
461 { |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2617
diff
changeset
|
462 origin = Json::objectValue; |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2617
diff
changeset
|
463 origin["RemoteIp"] = remoteIp; |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2617
diff
changeset
|
464 origin["RemoteAet"] = remoteAet; |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2617
diff
changeset
|
465 origin["CalledAet"] = calledAet; |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2617
diff
changeset
|
466 origin["Manufacturer"] = EnumerationToString(manufacturer); |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2617
diff
changeset
|
467 } |
565
c931ac02db82
refactoring of find class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
468 } |