annotate OrthancServer/QueryRetrieveHandler.cpp @ 2242:4e8e0ad2001c

move USleep() in SystemToolbox
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 19 Dec 2016 15:31:01 +0100
parents e7beca979562
children a3a65de1840f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1787
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 *
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * This program is free software: you can redistribute it and/or
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * published by the Free Software Foundation, either version 3 of the
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * License, or (at your option) any later version.
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 *
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * In addition, as a special exception, the copyright holders of this
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * program give permission to link the code of its release with the
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * that use the same license as the "OpenSSL" library), and distribute
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * the linked executables. You must obey the GNU General Public License
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * in all respects for all of the code used other than "OpenSSL". If you
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * modify file(s) with this exception, you may extend this exception to
b22ba8c5edbe query retrieve
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
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * you do not wish to do so, delete this exception statement from your
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * version. If you delete this exception statement from all source files
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * in the program, then also delete it here.
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 *
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * This program is distributed in the hope that it will be useful, but
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * WITHOUT ANY WARRANTY; without even the implied warranty of
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * General Public License for more details.
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 *
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * You should have received a copy of the GNU General Public License
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 **/
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 #include "PrecompiledHeadersServer.h"
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #include "QueryRetrieveHandler.h"
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 #include "OrthancInitialization.h"
2218
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
37 #include "FromDcmtkBridge.h"
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 namespace Orthanc
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 {
2218
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
42 static void FixQuery(DicomMap& query,
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
43 ServerContext& context,
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
44 const std::string& modality)
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
45 {
2221
e7beca979562 fix Windows build due to overwriting a macro
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
46 static const char* LUA_CALLBACK = "OutgoingFindRequestFilter";
e7beca979562 fix Windows build due to overwriting a macro
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
47
2218
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
48 LuaScripting::Locker locker(context.GetLua());
2221
e7beca979562 fix Windows build due to overwriting a macro
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
49 if (locker.GetLua().IsExistingFunction(LUA_CALLBACK))
2218
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
50 {
2221
e7beca979562 fix Windows build due to overwriting a macro
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
51 LuaFunctionCall call(locker.GetLua(), LUA_CALLBACK);
2218
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
52 call.PushDicom(query);
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
53 call.PushJson(modality);
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
54 FromDcmtkBridge::ExecuteToDicom(query, call);
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
55 }
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
56 }
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
57
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
58
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
59 static void FixQuery(DicomMap& query,
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
60 ModalityManufacturer manufacturer)
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
61 {
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
62 /**
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
63 * Introduce patches for specific manufacturers below.
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
64 **/
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
65
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
66 switch (manufacturer)
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
67 {
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
68 default:
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
69 break;
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
70 }
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
71 }
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
72
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
73
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 void QueryRetrieveHandler::Invalidate()
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 {
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 done_ = false;
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 answers_.Clear();
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 void QueryRetrieveHandler::Run()
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 {
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 if (!done_)
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 {
2218
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
85 // Firstly, fix the content of the query for specific manufacturers
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
86 DicomMap fixed;
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
87 fixed.Assign(query_);
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
88 FixQuery(fixed, modality_.GetManufacturer());
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
89
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
90 // Secondly, possibly fix the query with the user-provider Lua callback
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
91 FixQuery(fixed, context_, modality_.GetApplicationEntityTitle());
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
92
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
93 {
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
94 // Finally, run the C-FIND SCU against the fixed query
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
95 ReusableDicomUserConnection::Locker locker(context_.GetReusableDicomUserConnection(), localAet_, modality_);
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
96 locker.GetConnection().Find(answers_, level_, fixed);
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
97 }
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
98
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 done_ = true;
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 QueryRetrieveHandler::QueryRetrieveHandler(ServerContext& context) :
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 context_(context),
1427
d710ea64f0fd Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
106 localAet_(context.GetDefaultLocalApplicationEntityTitle()),
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 done_(false),
2059
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
108 level_(ResourceType_Study),
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
109 answers_(false)
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 {
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 void QueryRetrieveHandler::SetModality(const std::string& symbolicName)
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 {
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 Invalidate();
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 modalityName_ = symbolicName;
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 Configuration::GetDicomModalityUsingSymbolicName(modality_, symbolicName);
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 void QueryRetrieveHandler::SetLevel(ResourceType level)
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 {
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 Invalidate();
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 level_ = level;
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 void QueryRetrieveHandler::SetQuery(const DicomTag& tag,
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 const std::string& value)
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 {
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 Invalidate();
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
133 query_.SetValue(tag, value, false);
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 size_t QueryRetrieveHandler::GetAnswerCount()
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 {
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 Run();
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 return answers_.GetSize();
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143
1787
1b1d5470233f refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
144 void QueryRetrieveHandler::GetAnswer(DicomMap& target,
1b1d5470233f refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
145 size_t i)
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 {
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 Run();
2209
e3fd5bc429a2 URI to reconstruct the main DICOM tags, the JSON summary and the metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2059
diff changeset
148 answers_.GetAnswer(i).ExtractDicomSummary(target);
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 void QueryRetrieveHandler::Retrieve(const std::string& target,
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 size_t i)
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 {
1787
1b1d5470233f refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
155 DicomMap map;
1b1d5470233f refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
156 GetAnswer(map, i);
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 {
1787
1b1d5470233f refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
159 ReusableDicomUserConnection::Locker locker(context_.GetReusableDicomUserConnection(), localAet_, modality_);
1b1d5470233f refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
160 locker.GetConnection().Move(target, map);
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 void QueryRetrieveHandler::Retrieve(const std::string& target)
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 {
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 for (size_t i = 0; i < GetAnswerCount(); i++)
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 {
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 Retrieve(target, i);
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 }