annotate OrthancServer/Sources/QueryRetrieveHandler.cpp @ 5633:5db4ed395d81

merge
author Alain Mazy <am@orthanc.team>
date Tue, 21 May 2024 12:28:21 +0200
parents 48b8dae6dc77
children f7adfb22e20e
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
5485
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
5 * Copyright (C) 2017-2024 Osimis S.A., Belgium
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
6 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * This program is free software: you can redistribute it and/or
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * modify it under the terms of the GNU General Public License as
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * published by the Free Software Foundation, either version 3 of the
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * License, or (at your option) any later version.
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 *
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * 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
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * General Public License for more details.
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 *
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 **/
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
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 #include "PrecompiledHeadersServer.h"
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include "QueryRetrieveHandler.h"
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
2940
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2867
diff changeset
26 #include "OrthancConfiguration.h"
2616
2f3007bf0708 event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2612
diff changeset
27
4045
05b8fd21089c fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
28 #include "../../OrthancFramework/Sources/DicomNetworking/DicomControlUserConnection.h"
05b8fd21089c fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
29 #include "../../OrthancFramework/Sources/Logging.h"
4105
c02a2d9efbc2 move FromDcmtkBridge::ExecuteToDicom() to LuaFunctionCall, to remove dependency of DCMTK on Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
30 #include "../../OrthancFramework/Sources/Lua/LuaFunctionCall.h"
3096
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
31 #include "LuaScripting.h"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
32 #include "ServerContext.h"
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 namespace Orthanc
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 {
2616
2f3007bf0708 event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2612
diff changeset
37 static void FixQueryLua(DicomMap& query,
2f3007bf0708 event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2612
diff changeset
38 ServerContext& context,
2f3007bf0708 event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2612
diff changeset
39 const std::string& modality)
2218
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
40 {
2221
e7beca979562 fix Windows build due to overwriting a macro
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2218
diff changeset
41 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
42
2617
912a767911b0 back to a single Lua context
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2616
diff changeset
43 LuaScripting::Lock lock(context.GetLuaScripting());
2616
2f3007bf0708 event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2612
diff changeset
44
2f3007bf0708 event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2612
diff changeset
45 if (lock.GetLua().IsExistingFunction(LUA_CALLBACK))
2218
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
46 {
2616
2f3007bf0708 event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2612
diff changeset
47 LuaFunctionCall call(lock.GetLua(), LUA_CALLBACK);
2218
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
48 call.PushDicom(query);
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
49 call.PushJson(modality);
4105
c02a2d9efbc2 move FromDcmtkBridge::ExecuteToDicom() to LuaFunctionCall, to remove dependency of DCMTK on Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
50 call.ExecuteToDicom(query);
2218
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
51 }
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
52 }
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
53
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
54
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 void QueryRetrieveHandler::Invalidate()
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 {
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 done_ = false;
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 answers_.Clear();
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 void QueryRetrieveHandler::Run()
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 {
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 if (!done_)
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 {
2218
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
66 // 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
67 DicomMap fixed;
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
68 fixed.Assign(query_);
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
69
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
70 // Secondly, possibly fix the query with the user-provider Lua callback
2616
2f3007bf0708 event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2612
diff changeset
71 FixQueryLua(fixed, context_, modality_.GetApplicationEntityTitle());
2218
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
72
2843
4ee3a759afea Fix: Closing DICOM associations after running query/retrieve from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2617
diff changeset
73 {
3874
2effa961f67f forcing use of DicomAssociationParameters if creating an SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3843
diff changeset
74 DicomAssociationParameters params(localAet_, modality_);
4517
c494ee5d0101 Added "Timeout" parameter everywhere in "/modalities/.../"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4462
diff changeset
75
c494ee5d0101 Added "Timeout" parameter everywhere in "/modalities/.../"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4462
diff changeset
76 if (timeout_ != 0)
c494ee5d0101 Added "Timeout" parameter everywhere in "/modalities/.../"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4462
diff changeset
77 {
c494ee5d0101 Added "Timeout" parameter everywhere in "/modalities/.../"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4462
diff changeset
78 params.SetTimeout(timeout_);
c494ee5d0101 Added "Timeout" parameter everywhere in "/modalities/.../"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4462
diff changeset
79 }
c494ee5d0101 Added "Timeout" parameter everywhere in "/modalities/.../"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4462
diff changeset
80
3874
2effa961f67f forcing use of DicomAssociationParameters if creating an SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3843
diff changeset
81 DicomControlUserConnection connection(params);
3370
872bd3b6ec72 "/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3096
diff changeset
82 connection.Find(answers_, level_, fixed, findNormalized_);
2843
4ee3a759afea Fix: Closing DICOM associations after running query/retrieve from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2617
diff changeset
83 }
2218
3eefb84ac0bd dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2209
diff changeset
84
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 done_ = true;
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 QueryRetrieveHandler::QueryRetrieveHandler(ServerContext& context) :
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 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
92 localAet_(context.GetDefaultLocalApplicationEntityTitle()),
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 done_(false),
2059
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
94 level_(ResourceType_Study),
3370
872bd3b6ec72 "/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3096
diff changeset
95 answers_(false),
4517
c494ee5d0101 Added "Timeout" parameter everywhere in "/modalities/.../"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4462
diff changeset
96 findNormalized_(true),
c494ee5d0101 Added "Timeout" parameter everywhere in "/modalities/.../"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4462
diff changeset
97 timeout_(0)
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 {
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 }
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 void QueryRetrieveHandler::SetModality(const std::string& symbolicName)
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 Invalidate();
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 modalityName_ = symbolicName;
2940
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2867
diff changeset
106
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2867
diff changeset
107 {
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2867
diff changeset
108 OrthancConfiguration::ReaderLock lock;
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2867
diff changeset
109 lock.GetConfiguration().GetDicomModalityUsingSymbolicName(modality_, symbolicName);
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2867
diff changeset
110 }
1368
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
4462
da460bef88f8 "/modalities/{...}/query": New string argument "LocalAet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
114 void QueryRetrieveHandler::SetLocalAet(const std::string& localAet)
da460bef88f8 "/modalities/{...}/query": New string argument "LocalAet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
115 {
da460bef88f8 "/modalities/{...}/query": New string argument "LocalAet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
116 Invalidate();
da460bef88f8 "/modalities/{...}/query": New string argument "LocalAet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
117 localAet_ = localAet;
da460bef88f8 "/modalities/{...}/query": New string argument "LocalAet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
118 }
da460bef88f8 "/modalities/{...}/query": New string argument "LocalAet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
119
da460bef88f8 "/modalities/{...}/query": New string argument "LocalAet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
120
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 void QueryRetrieveHandler::SetLevel(ResourceType level)
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 {
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 Invalidate();
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 level_ = level;
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 }
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 void QueryRetrieveHandler::SetQuery(const DicomTag& tag,
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 const std::string& value)
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 {
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 Invalidate();
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
132 query_.SetValue(tag, value, false);
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 }
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
2986
b1ba0a8311b5 exploring hierarchy of C-FIND answers finished
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
136 void QueryRetrieveHandler::CopyStringTag(const DicomMap& from,
b1ba0a8311b5 exploring hierarchy of C-FIND answers finished
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
137 const DicomTag& tag)
b1ba0a8311b5 exploring hierarchy of C-FIND answers finished
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
138 {
b1ba0a8311b5 exploring hierarchy of C-FIND answers finished
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
139 const DicomValue* value = from.TestAndGetValue(tag);
b1ba0a8311b5 exploring hierarchy of C-FIND answers finished
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
140
b1ba0a8311b5 exploring hierarchy of C-FIND answers finished
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
141 if (value == NULL ||
b1ba0a8311b5 exploring hierarchy of C-FIND answers finished
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
142 value->IsNull() ||
b1ba0a8311b5 exploring hierarchy of C-FIND answers finished
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
143 value->IsBinary())
b1ba0a8311b5 exploring hierarchy of C-FIND answers finished
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
144 {
b1ba0a8311b5 exploring hierarchy of C-FIND answers finished
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
145 throw OrthancException(ErrorCode_InexistentTag);
b1ba0a8311b5 exploring hierarchy of C-FIND answers finished
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
146 }
b1ba0a8311b5 exploring hierarchy of C-FIND answers finished
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
147 else
b1ba0a8311b5 exploring hierarchy of C-FIND answers finished
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
148 {
b1ba0a8311b5 exploring hierarchy of C-FIND answers finished
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
149 SetQuery(tag, value->GetContent());
b1ba0a8311b5 exploring hierarchy of C-FIND answers finished
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
150 }
b1ba0a8311b5 exploring hierarchy of C-FIND answers finished
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
151 }
b1ba0a8311b5 exploring hierarchy of C-FIND answers finished
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
152
b1ba0a8311b5 exploring hierarchy of C-FIND answers finished
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
153
2867
251614c2edac DicomMoveScuJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2843
diff changeset
154 size_t QueryRetrieveHandler::GetAnswersCount()
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 {
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 Run();
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 return answers_.GetSize();
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160
1787
1b1d5470233f refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
161 void QueryRetrieveHandler::GetAnswer(DicomMap& target,
1b1d5470233f refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
162 size_t i)
1368
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 Run();
4139
a4f28efdfccf "maxTagLength" must be explicitly given to ParsedDicomFile::ExtractDicomSummary()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4105
diff changeset
165 answers_.GetAnswer(i).ExtractDicomSummary(target, 0 /* don't truncate tags */);
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 }
3370
872bd3b6ec72 "/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3096
diff changeset
167
872bd3b6ec72 "/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3096
diff changeset
168
872bd3b6ec72 "/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3096
diff changeset
169 void QueryRetrieveHandler::SetFindNormalized(bool normalized)
872bd3b6ec72 "/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3096
diff changeset
170 {
872bd3b6ec72 "/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3096
diff changeset
171 Invalidate();
872bd3b6ec72 "/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3096
diff changeset
172 findNormalized_ = normalized;
872bd3b6ec72 "/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3096
diff changeset
173 }
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 }