Mercurial > hg > orthanc
annotate OrthancServer/OrthancRestApi/OrthancRestModalities.cpp @ 1368:b22ba8c5edbe query-retrieve
query retrieve
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 26 May 2015 17:54:34 +0200 |
parents | 6e7e5ed91c2d |
children | d710ea64f0fd |
rev | line source |
---|---|
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1165
diff
changeset
|
3 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics |
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1165
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 * |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * This program is free software: you can redistribute it and/or |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * modify it under the terms of the GNU General Public License as |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * published by the Free Software Foundation, either version 3 of the |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * License, or (at your option) any later version. |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * In addition, as a special exception, the copyright holders of this |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * program give permission to link the code of its release with the |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * that use the same license as the "OpenSSL" library), and distribute |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * the linked executables. You must obey the GNU General Public License |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * in all respects for all of the code used other than "OpenSSL". If you |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * modify file(s) with this exception, you may extend this exception to |
5197fd35333c
refactoring of OrthancRestApi
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 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * you do not wish to do so, delete this exception statement from your |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 * version. If you delete this exception statement from all source files |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 * in the program, then also delete it here. |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 * |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 * This program is distributed in the hope that it will be useful, but |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 * WITHOUT ANY WARRANTY; without even the implied warranty of |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 * General Public License for more details. |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 * |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 * You should have received a copy of the GNU General Public License |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 **/ |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 |
831
84513f2ee1f3
pch for unit tests and server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
33 #include "../PrecompiledHeadersServer.h" |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 #include "OrthancRestApi.h" |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 #include "../OrthancInitialization.h" |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 #include "../../Core/HttpClient.h" |
795 | 38 #include "../FromDcmtkBridge.h" |
999 | 39 #include "../Scheduler/ServerJob.h" |
1000
13e230bbd882
rename filter to command
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
999
diff
changeset
|
40 #include "../Scheduler/StoreScuCommand.h" |
1007
871c49c9b11d
lua routing is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1000
diff
changeset
|
41 #include "../Scheduler/StorePeerCommand.h" |
1368 | 42 #include "../QueryRetrieveHandler.h" |
43 #include "../ServerToolbox.h" | |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 #include <glog/logging.h> |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 namespace Orthanc |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 { |
1368 | 49 /*************************************************************************** |
50 * DICOM C-Echo SCU | |
51 ***************************************************************************/ | |
1049
bd2cb95003da
C-Echo SCU in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1007
diff
changeset
|
52 |
bd2cb95003da
C-Echo SCU in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1007
diff
changeset
|
53 static void DicomEcho(RestApiPostCall& call) |
bd2cb95003da
C-Echo SCU in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1007
diff
changeset
|
54 { |
bd2cb95003da
C-Echo SCU in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1007
diff
changeset
|
55 ServerContext& context = OrthancRestApi::GetContext(call); |
bd2cb95003da
C-Echo SCU in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1007
diff
changeset
|
56 |
bd2cb95003da
C-Echo SCU in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1007
diff
changeset
|
57 RemoteModalityParameters remote = Configuration::GetModalityUsingSymbolicName(call.GetUriComponent("id", "")); |
bd2cb95003da
C-Echo SCU in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1007
diff
changeset
|
58 ReusableDicomUserConnection::Locker locker(context.GetReusableDicomUserConnection(), remote); |
bd2cb95003da
C-Echo SCU in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1007
diff
changeset
|
59 |
bd2cb95003da
C-Echo SCU in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1007
diff
changeset
|
60 try |
bd2cb95003da
C-Echo SCU in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1007
diff
changeset
|
61 { |
bd2cb95003da
C-Echo SCU in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1007
diff
changeset
|
62 if (locker.GetConnection().Echo()) |
bd2cb95003da
C-Echo SCU in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1007
diff
changeset
|
63 { |
1165
0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1142
diff
changeset
|
64 // Echo has succeeded |
1049
bd2cb95003da
C-Echo SCU in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1007
diff
changeset
|
65 call.GetOutput().AnswerBuffer("{}", "application/json"); |
1165
0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1142
diff
changeset
|
66 return; |
1049
bd2cb95003da
C-Echo SCU in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1007
diff
changeset
|
67 } |
bd2cb95003da
C-Echo SCU in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1007
diff
changeset
|
68 } |
bd2cb95003da
C-Echo SCU in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1007
diff
changeset
|
69 catch (OrthancException&) |
bd2cb95003da
C-Echo SCU in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1007
diff
changeset
|
70 { |
bd2cb95003da
C-Echo SCU in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1007
diff
changeset
|
71 } |
1165
0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1142
diff
changeset
|
72 |
0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1142
diff
changeset
|
73 // Echo has failed |
0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1142
diff
changeset
|
74 call.GetOutput().SignalError(HttpStatus_500_InternalServerError); |
1049
bd2cb95003da
C-Echo SCU in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1007
diff
changeset
|
75 } |
bd2cb95003da
C-Echo SCU in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1007
diff
changeset
|
76 |
bd2cb95003da
C-Echo SCU in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1007
diff
changeset
|
77 |
1368 | 78 |
79 /*************************************************************************** | |
80 * DICOM C-Find SCU => DEPRECATED! | |
81 ***************************************************************************/ | |
82 | |
83 static bool MergeQueryAndTemplate(DicomMap& result, | |
84 const std::string& postData) | |
85 { | |
86 Json::Value query; | |
87 Json::Reader reader; | |
88 | |
89 if (!reader.parse(postData, query) || | |
90 query.type() != Json::objectValue) | |
91 { | |
92 return false; | |
93 } | |
94 | |
95 Json::Value::Members members = query.getMemberNames(); | |
96 for (size_t i = 0; i < members.size(); i++) | |
97 { | |
98 DicomTag t = FromDcmtkBridge::ParseTag(members[i]); | |
99 result.SetValue(t, query[members[i]].asString()); | |
100 } | |
101 | |
102 return true; | |
103 } | |
104 | |
105 | |
106 static void FindPatient(DicomFindAnswers& result, | |
107 DicomUserConnection& connection, | |
108 const DicomMap& fields) | |
109 { | |
110 // Only keep the filters from "fields" that are related to the patient | |
111 DicomMap s; | |
112 fields.ExtractPatientInformation(s); | |
113 connection.Find(result, ResourceType_Patient, s); | |
114 } | |
115 | |
116 | |
117 static void FindStudy(DicomFindAnswers& result, | |
118 DicomUserConnection& connection, | |
119 const DicomMap& fields) | |
120 { | |
121 // Only keep the filters from "fields" that are related to the study | |
122 DicomMap s; | |
123 fields.ExtractStudyInformation(s); | |
124 | |
125 s.CopyTagIfExists(fields, DICOM_TAG_PATIENT_ID); | |
126 s.CopyTagIfExists(fields, DICOM_TAG_ACCESSION_NUMBER); | |
127 s.CopyTagIfExists(fields, DICOM_TAG_MODALITIES_IN_STUDY); | |
128 | |
129 connection.Find(result, ResourceType_Study, s); | |
130 } | |
131 | |
132 static void FindSeries(DicomFindAnswers& result, | |
133 DicomUserConnection& connection, | |
134 const DicomMap& fields) | |
135 { | |
136 // Only keep the filters from "fields" that are related to the series | |
137 DicomMap s; | |
138 fields.ExtractSeriesInformation(s); | |
139 | |
140 s.CopyTagIfExists(fields, DICOM_TAG_PATIENT_ID); | |
141 s.CopyTagIfExists(fields, DICOM_TAG_ACCESSION_NUMBER); | |
142 s.CopyTagIfExists(fields, DICOM_TAG_STUDY_INSTANCE_UID); | |
143 | |
144 connection.Find(result, ResourceType_Series, s); | |
145 } | |
146 | |
147 static void FindInstance(DicomFindAnswers& result, | |
148 DicomUserConnection& connection, | |
149 const DicomMap& fields) | |
150 { | |
151 // Only keep the filters from "fields" that are related to the instance | |
152 DicomMap s; | |
153 fields.ExtractInstanceInformation(s); | |
154 | |
155 s.CopyTagIfExists(fields, DICOM_TAG_PATIENT_ID); | |
156 s.CopyTagIfExists(fields, DICOM_TAG_ACCESSION_NUMBER); | |
157 s.CopyTagIfExists(fields, DICOM_TAG_STUDY_INSTANCE_UID); | |
158 s.CopyTagIfExists(fields, DICOM_TAG_SERIES_INSTANCE_UID); | |
159 | |
160 connection.Find(result, ResourceType_Instance, s); | |
161 } | |
162 | |
163 | |
974 | 164 static void DicomFindPatient(RestApiPostCall& call) |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
165 { |
1368 | 166 LOG(WARNING) << "This URI is deprecated: " << call.FlattenUri(); |
773 | 167 ServerContext& context = OrthancRestApi::GetContext(call); |
168 | |
1368 | 169 DicomMap fields; |
170 DicomMap::SetupFindPatientTemplate(fields); | |
171 if (!MergeQueryAndTemplate(fields, call.GetPostBody())) | |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
172 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
173 return; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
174 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
175 |
810
401a9633e492
configuration into a namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
808
diff
changeset
|
176 RemoteModalityParameters remote = Configuration::GetModalityUsingSymbolicName(call.GetUriComponent("id", "")); |
776 | 177 ReusableDicomUserConnection::Locker locker(context.GetReusableDicomUserConnection(), remote); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
178 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
179 DicomFindAnswers answers; |
1368 | 180 FindPatient(answers, locker.GetConnection(), fields); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
181 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
182 Json::Value result; |
1368 | 183 answers.ToJson(result, true); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
184 call.GetOutput().AnswerJson(result); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
185 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
186 |
974 | 187 static void DicomFindStudy(RestApiPostCall& call) |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
188 { |
1368 | 189 LOG(WARNING) << "This URI is deprecated: " << call.FlattenUri(); |
773 | 190 ServerContext& context = OrthancRestApi::GetContext(call); |
191 | |
1368 | 192 DicomMap fields; |
193 DicomMap::SetupFindStudyTemplate(fields); | |
194 if (!MergeQueryAndTemplate(fields, call.GetPostBody())) | |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
195 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
196 return; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
197 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
198 |
1368 | 199 if (fields.GetValue(DICOM_TAG_ACCESSION_NUMBER).AsString().size() <= 2 && |
200 fields.GetValue(DICOM_TAG_PATIENT_ID).AsString().size() <= 2) | |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
201 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
202 return; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
203 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
204 |
810
401a9633e492
configuration into a namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
808
diff
changeset
|
205 RemoteModalityParameters remote = Configuration::GetModalityUsingSymbolicName(call.GetUriComponent("id", "")); |
776 | 206 ReusableDicomUserConnection::Locker locker(context.GetReusableDicomUserConnection(), remote); |
773 | 207 |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
208 DicomFindAnswers answers; |
1368 | 209 FindStudy(answers, locker.GetConnection(), fields); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
210 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
211 Json::Value result; |
1368 | 212 answers.ToJson(result, true); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
213 call.GetOutput().AnswerJson(result); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
214 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
215 |
974 | 216 static void DicomFindSeries(RestApiPostCall& call) |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
217 { |
1368 | 218 LOG(WARNING) << "This URI is deprecated: " << call.FlattenUri(); |
773 | 219 ServerContext& context = OrthancRestApi::GetContext(call); |
220 | |
1368 | 221 DicomMap fields; |
222 DicomMap::SetupFindSeriesTemplate(fields); | |
223 if (!MergeQueryAndTemplate(fields, call.GetPostBody())) | |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
224 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
225 return; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
226 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
227 |
1368 | 228 if ((fields.GetValue(DICOM_TAG_ACCESSION_NUMBER).AsString().size() <= 2 && |
229 fields.GetValue(DICOM_TAG_PATIENT_ID).AsString().size() <= 2) || | |
230 fields.GetValue(DICOM_TAG_STUDY_INSTANCE_UID).AsString().size() <= 2) | |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
231 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
232 return; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
233 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
234 |
810
401a9633e492
configuration into a namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
808
diff
changeset
|
235 RemoteModalityParameters remote = Configuration::GetModalityUsingSymbolicName(call.GetUriComponent("id", "")); |
776 | 236 ReusableDicomUserConnection::Locker locker(context.GetReusableDicomUserConnection(), remote); |
773 | 237 |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
238 DicomFindAnswers answers; |
1368 | 239 FindSeries(answers, locker.GetConnection(), fields); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
240 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
241 Json::Value result; |
1368 | 242 answers.ToJson(result, true); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
243 call.GetOutput().AnswerJson(result); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
244 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
245 |
974 | 246 static void DicomFindInstance(RestApiPostCall& call) |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
247 { |
1368 | 248 LOG(WARNING) << "This URI is deprecated: " << call.FlattenUri(); |
773 | 249 ServerContext& context = OrthancRestApi::GetContext(call); |
250 | |
1368 | 251 DicomMap fields; |
252 DicomMap::SetupFindInstanceTemplate(fields); | |
253 if (!MergeQueryAndTemplate(fields, call.GetPostBody())) | |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
254 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
255 return; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
256 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
257 |
1368 | 258 if ((fields.GetValue(DICOM_TAG_ACCESSION_NUMBER).AsString().size() <= 2 && |
259 fields.GetValue(DICOM_TAG_PATIENT_ID).AsString().size() <= 2) || | |
260 fields.GetValue(DICOM_TAG_STUDY_INSTANCE_UID).AsString().size() <= 2 || | |
261 fields.GetValue(DICOM_TAG_SERIES_INSTANCE_UID).AsString().size() <= 2) | |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
262 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
263 return; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
264 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
265 |
810
401a9633e492
configuration into a namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
808
diff
changeset
|
266 RemoteModalityParameters remote = Configuration::GetModalityUsingSymbolicName(call.GetUriComponent("id", "")); |
776 | 267 ReusableDicomUserConnection::Locker locker(context.GetReusableDicomUserConnection(), remote); |
773 | 268 |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
269 DicomFindAnswers answers; |
1368 | 270 FindInstance(answers, locker.GetConnection(), fields); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
271 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
272 Json::Value result; |
1368 | 273 answers.ToJson(result, true); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
274 call.GetOutput().AnswerJson(result); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
275 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
276 |
1368 | 277 |
974 | 278 static void DicomFind(RestApiPostCall& call) |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
279 { |
1368 | 280 LOG(WARNING) << "This URI is deprecated: " << call.FlattenUri(); |
773 | 281 ServerContext& context = OrthancRestApi::GetContext(call); |
282 | |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
283 DicomMap m; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
284 DicomMap::SetupFindPatientTemplate(m); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
285 if (!MergeQueryAndTemplate(m, call.GetPostBody())) |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
286 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
287 return; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
288 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
289 |
810
401a9633e492
configuration into a namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
808
diff
changeset
|
290 RemoteModalityParameters remote = Configuration::GetModalityUsingSymbolicName(call.GetUriComponent("id", "")); |
776 | 291 ReusableDicomUserConnection::Locker locker(context.GetReusableDicomUserConnection(), remote); |
773 | 292 |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
293 DicomFindAnswers patients; |
1368 | 294 FindPatient(patients, locker.GetConnection(), m); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
295 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
296 // Loop over the found patients |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
297 Json::Value result = Json::arrayValue; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
298 for (size_t i = 0; i < patients.GetSize(); i++) |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
299 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
300 Json::Value patient(Json::objectValue); |
1368 | 301 FromDcmtkBridge::ToJson(patient, patients.GetAnswer(i), true); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
302 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
303 DicomMap::SetupFindStudyTemplate(m); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
304 if (!MergeQueryAndTemplate(m, call.GetPostBody())) |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
305 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
306 return; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
307 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
308 m.CopyTagIfExists(patients.GetAnswer(i), DICOM_TAG_PATIENT_ID); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
309 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
310 DicomFindAnswers studies; |
1368 | 311 FindStudy(studies, locker.GetConnection(), m); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
312 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
313 patient["Studies"] = Json::arrayValue; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
314 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
315 // Loop over the found studies |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
316 for (size_t j = 0; j < studies.GetSize(); j++) |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
317 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
318 Json::Value study(Json::objectValue); |
1368 | 319 FromDcmtkBridge::ToJson(study, studies.GetAnswer(j), true); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
320 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
321 DicomMap::SetupFindSeriesTemplate(m); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
322 if (!MergeQueryAndTemplate(m, call.GetPostBody())) |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
323 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
324 return; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
325 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
326 m.CopyTagIfExists(studies.GetAnswer(j), DICOM_TAG_PATIENT_ID); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
327 m.CopyTagIfExists(studies.GetAnswer(j), DICOM_TAG_STUDY_INSTANCE_UID); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
328 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
329 DicomFindAnswers series; |
1368 | 330 FindSeries(series, locker.GetConnection(), m); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
331 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
332 // Loop over the found series |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
333 study["Series"] = Json::arrayValue; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
334 for (size_t k = 0; k < series.GetSize(); k++) |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
335 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
336 Json::Value series2(Json::objectValue); |
1368 | 337 FromDcmtkBridge::ToJson(series2, series.GetAnswer(k), true); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
338 study["Series"].append(series2); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
339 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
340 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
341 patient["Studies"].append(study); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
342 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
343 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
344 result.append(patient); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
345 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
346 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
347 call.GetOutput().AnswerJson(result); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
348 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
349 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
350 |
1368 | 351 |
352 /*************************************************************************** | |
353 * DICOM C-Find and C-Move SCU => Recommended since Orthanc 0.9.0 | |
354 ***************************************************************************/ | |
355 | |
356 static void DicomQuery(RestApiPostCall& call) | |
357 { | |
358 ServerContext& context = OrthancRestApi::GetContext(call); | |
359 Json::Value request; | |
360 | |
361 if (call.ParseJsonRequest(request) && | |
362 request.type() == Json::objectValue && | |
363 request.isMember("Level") && request["Level"].type() == Json::stringValue && | |
364 (!request.isMember("Query") || request["Query"].type() == Json::objectValue)) | |
365 { | |
366 std::auto_ptr<QueryRetrieveHandler> handler(new QueryRetrieveHandler(context)); | |
367 | |
368 handler->SetModality(call.GetUriComponent("id", "")); | |
369 handler->SetLevel(StringToResourceType(request["Level"].asString().c_str())); | |
370 | |
371 if (request.isMember("Query")) | |
372 { | |
373 Json::Value::Members tags = request["Query"].getMemberNames(); | |
374 for (size_t i = 0; i < tags.size(); i++) | |
375 { | |
376 handler->SetQuery(FromDcmtkBridge::ParseTag(tags[i].c_str()), | |
377 request["Query"][tags[i]].asString()); | |
378 } | |
379 } | |
380 | |
381 handler->Run(); | |
382 | |
383 std::string s = context.GetQueryRetrieveArchive().Add(handler.release()); | |
384 Json::Value result = Json::objectValue; | |
385 result["ID"] = s; | |
386 result["Path"] = "/queries/" + s; | |
387 call.GetOutput().AnswerJson(result); | |
388 } | |
389 } | |
390 | |
391 | |
392 static void ListQueries(RestApiGetCall& call) | |
393 { | |
394 ServerContext& context = OrthancRestApi::GetContext(call); | |
395 | |
396 std::list<std::string> queries; | |
397 context.GetQueryRetrieveArchive().List(queries); | |
398 | |
399 Json::Value result = Json::arrayValue; | |
400 for (std::list<std::string>::const_iterator | |
401 it = queries.begin(); it != queries.end(); ++it) | |
402 { | |
403 result.append(*it); | |
404 } | |
405 | |
406 call.GetOutput().AnswerJson(result); | |
407 } | |
408 | |
409 | |
410 namespace | |
411 { | |
412 class QueryAccessor | |
413 { | |
414 private: | |
415 ServerContext& context_; | |
416 SharedArchive::Accessor accessor_; | |
417 QueryRetrieveHandler& handler_; | |
418 | |
419 public: | |
420 QueryAccessor(RestApiCall& call) : | |
421 context_(OrthancRestApi::GetContext(call)), | |
422 accessor_(context_.GetQueryRetrieveArchive(), call.GetUriComponent("id", "")), | |
423 handler_(dynamic_cast<QueryRetrieveHandler&>(accessor_.GetItem())) | |
424 { | |
425 } | |
426 | |
427 QueryRetrieveHandler* operator->() | |
428 { | |
429 return &handler_; | |
430 } | |
431 }; | |
432 | |
433 static void AnswerDicomMap(RestApiCall& call, | |
434 const DicomMap& value, | |
435 bool simplify) | |
436 { | |
437 Json::Value full = Json::objectValue; | |
438 FromDcmtkBridge::ToJson(full, value, simplify); | |
439 call.GetOutput().AnswerJson(full); | |
440 } | |
441 } | |
442 | |
443 | |
444 static void ListQueryAnswers(RestApiGetCall& call) | |
445 { | |
446 QueryAccessor query(call); | |
447 size_t count = query->GetAnswerCount(); | |
448 | |
449 Json::Value result = Json::arrayValue; | |
450 for (size_t i = 0; i < count; i++) | |
451 { | |
452 result.append(boost::lexical_cast<std::string>(i)); | |
453 } | |
454 | |
455 call.GetOutput().AnswerJson(result); | |
456 } | |
457 | |
458 | |
459 static void GetQueryOneAnswer(RestApiGetCall& call) | |
460 { | |
461 size_t index = boost::lexical_cast<size_t>(call.GetUriComponent("index", "")); | |
462 QueryAccessor query(call); | |
463 AnswerDicomMap(call, query->GetAnswer(index), call.HasArgument("simplify")); | |
464 } | |
465 | |
466 | |
467 static void RetrieveOneAnswer(RestApiPostCall& call) | |
468 { | |
469 size_t index = boost::lexical_cast<size_t>(call.GetUriComponent("index", "")); | |
470 | |
471 LOG(WARNING) << "Driving C-Move SCU on modality: " << call.GetPostBody(); | |
472 | |
473 QueryAccessor query(call); | |
474 query->Retrieve(call.GetPostBody(), index); | |
475 | |
476 // Retrieve has succeeded | |
477 call.GetOutput().AnswerBuffer("{}", "application/json"); | |
478 } | |
479 | |
480 | |
481 static void RetrieveAllAnswers(RestApiPostCall& call) | |
482 { | |
483 LOG(WARNING) << "Driving C-Move SCU on modality: " << call.GetPostBody(); | |
484 | |
485 QueryAccessor query(call); | |
486 query->Retrieve(call.GetPostBody()); | |
487 | |
488 // Retrieve has succeeded | |
489 call.GetOutput().AnswerBuffer("{}", "application/json"); | |
490 } | |
491 | |
492 | |
493 static void GetQueryArguments(RestApiGetCall& call) | |
494 { | |
495 QueryAccessor query(call); | |
496 AnswerDicomMap(call, query->GetQuery(), call.HasArgument("simplify")); | |
497 } | |
498 | |
499 | |
500 static void GetQueryLevel(RestApiGetCall& call) | |
501 { | |
502 QueryAccessor query(call); | |
503 call.GetOutput().AnswerBuffer(EnumerationToString(query->GetLevel()), "text/plain"); | |
504 } | |
505 | |
506 | |
507 static void GetQueryModality(RestApiGetCall& call) | |
508 { | |
509 QueryAccessor query(call); | |
510 call.GetOutput().AnswerBuffer(query->GetModalitySymbolicName(), "text/plain"); | |
511 } | |
512 | |
513 | |
514 static void DeleteQuery(RestApiDeleteCall& call) | |
515 { | |
516 ServerContext& context = OrthancRestApi::GetContext(call); | |
517 context.GetQueryRetrieveArchive().Remove(call.GetUriComponent("id", "")); | |
518 call.GetOutput().AnswerBuffer("", "text/plain"); | |
519 } | |
520 | |
521 | |
522 static void ListQueryOperations(RestApiGetCall& call) | |
523 { | |
524 // Ensure that the query of interest does exist | |
525 QueryAccessor query(call); | |
526 | |
527 RestApi::AutoListChildren(call); | |
528 } | |
529 | |
530 | |
531 static void ListQueryAnswerOperations(RestApiGetCall& call) | |
532 { | |
533 // Ensure that the query of interest does exist | |
534 QueryAccessor query(call); | |
535 | |
536 // Ensure that the answer of interest does exist | |
537 size_t index = boost::lexical_cast<size_t>(call.GetUriComponent("index", "")); | |
538 query->GetAnswer(index); | |
539 | |
540 RestApi::AutoListChildren(call); | |
541 } | |
542 | |
543 | |
544 | |
545 | |
546 /*************************************************************************** | |
547 * DICOM C-Store SCU | |
548 ***************************************************************************/ | |
549 | |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
550 static bool GetInstancesToExport(std::list<std::string>& instances, |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
551 const std::string& remote, |
974 | 552 RestApiPostCall& call) |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
553 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
554 ServerContext& context = OrthancRestApi::GetContext(call); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
555 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
556 std::string stripped = Toolbox::StripSpaces(call.GetPostBody()); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
557 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
558 Json::Value request; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
559 if (Toolbox::IsSHA1(stripped)) |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
560 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
561 // This is for compatibility with Orthanc <= 0.5.1. |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
562 request = stripped; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
563 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
564 else if (!call.ParseJsonRequest(request)) |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
565 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
566 // Bad JSON request |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
567 return false; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
568 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
569 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
570 if (request.isString()) |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
571 { |
1142
952cf9b6be83
Configuration option to disable the logging of exported resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1063
diff
changeset
|
572 if (Configuration::GetGlobalBoolParameter("LogExportedResources", true)) |
952cf9b6be83
Configuration option to disable the logging of exported resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1063
diff
changeset
|
573 { |
952cf9b6be83
Configuration option to disable the logging of exported resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1063
diff
changeset
|
574 context.GetIndex().LogExportedResource(request.asString(), remote); |
952cf9b6be83
Configuration option to disable the logging of exported resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1063
diff
changeset
|
575 } |
952cf9b6be83
Configuration option to disable the logging of exported resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1063
diff
changeset
|
576 |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
577 context.GetIndex().GetChildInstances(instances, request.asString()); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
578 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
579 else if (request.isArray()) |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
580 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
581 for (Json::Value::ArrayIndex i = 0; i < request.size(); i++) |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
582 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
583 if (!request[i].isString()) |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
584 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
585 return false; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
586 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
587 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
588 std::string stripped = Toolbox::StripSpaces(request[i].asString()); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
589 if (!Toolbox::IsSHA1(stripped)) |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
590 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
591 return false; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
592 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
593 |
1142
952cf9b6be83
Configuration option to disable the logging of exported resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1063
diff
changeset
|
594 if (Configuration::GetGlobalBoolParameter("LogExportedResources", true)) |
952cf9b6be83
Configuration option to disable the logging of exported resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1063
diff
changeset
|
595 { |
952cf9b6be83
Configuration option to disable the logging of exported resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1063
diff
changeset
|
596 context.GetIndex().LogExportedResource(stripped, remote); |
952cf9b6be83
Configuration option to disable the logging of exported resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1063
diff
changeset
|
597 } |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
598 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
599 std::list<std::string> tmp; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
600 context.GetIndex().GetChildInstances(tmp, stripped); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
601 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
602 for (std::list<std::string>::const_iterator |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
603 it = tmp.begin(); it != tmp.end(); ++it) |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
604 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
605 instances.push_back(*it); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
606 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
607 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
608 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
609 else |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
610 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
611 // Neither a string, nor a list of strings. Bad request. |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
612 return false; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
613 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
614 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
615 return true; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
616 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
617 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
618 |
974 | 619 static void DicomStore(RestApiPostCall& call) |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
620 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
621 ServerContext& context = OrthancRestApi::GetContext(call); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
622 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
623 std::string remote = call.GetUriComponent("id", ""); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
624 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
625 std::list<std::string> instances; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
626 if (!GetInstancesToExport(instances, remote, call)) |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
627 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
628 return; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
629 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
630 |
810
401a9633e492
configuration into a namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
808
diff
changeset
|
631 RemoteModalityParameters p = Configuration::GetModalityUsingSymbolicName(remote); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
632 |
999 | 633 ServerJob job; |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
634 for (std::list<std::string>::const_iterator |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
635 it = instances.begin(); it != instances.end(); ++it) |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
636 { |
1165
0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1142
diff
changeset
|
637 job.AddCommand(new StoreScuCommand(context, p, false)).AddInput(*it); |
999 | 638 } |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
639 |
1007
871c49c9b11d
lua routing is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1000
diff
changeset
|
640 job.SetDescription("HTTP request: Store-SCU to peer \"" + remote + "\""); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
641 |
1165
0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1142
diff
changeset
|
642 if (context.GetScheduler().SubmitAndWait(job)) |
0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1142
diff
changeset
|
643 { |
0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1142
diff
changeset
|
644 // Success |
0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1142
diff
changeset
|
645 call.GetOutput().AnswerBuffer("{}", "application/json"); |
0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1142
diff
changeset
|
646 } |
0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1142
diff
changeset
|
647 else |
0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1142
diff
changeset
|
648 { |
0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1142
diff
changeset
|
649 call.GetOutput().SignalError(HttpStatus_500_InternalServerError); |
0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1142
diff
changeset
|
650 } |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
651 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
652 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
653 |
1368 | 654 /*************************************************************************** |
655 * Orthanc Peers => Store client | |
656 ***************************************************************************/ | |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
657 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
658 static bool IsExistingPeer(const OrthancRestApi::SetOfStrings& peers, |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
659 const std::string& id) |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
660 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
661 return peers.find(id) != peers.end(); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
662 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
663 |
974 | 664 static void ListPeers(RestApiGetCall& call) |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
665 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
666 OrthancRestApi::SetOfStrings peers; |
810
401a9633e492
configuration into a namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
808
diff
changeset
|
667 Configuration::GetListOfOrthancPeers(peers); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
668 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
669 Json::Value result = Json::arrayValue; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
670 for (OrthancRestApi::SetOfStrings::const_iterator |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
671 it = peers.begin(); it != peers.end(); ++it) |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
672 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
673 result.append(*it); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
674 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
675 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
676 call.GetOutput().AnswerJson(result); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
677 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
678 |
974 | 679 static void ListPeerOperations(RestApiGetCall& call) |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
680 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
681 OrthancRestApi::SetOfStrings peers; |
810
401a9633e492
configuration into a namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
808
diff
changeset
|
682 Configuration::GetListOfOrthancPeers(peers); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
683 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
684 std::string id = call.GetUriComponent("id", ""); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
685 if (IsExistingPeer(peers, id)) |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
686 { |
1063
0332e6e8c679
Fix automated generation of the list of resource children in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1049
diff
changeset
|
687 RestApi::AutoListChildren(call); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
688 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
689 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
690 |
974 | 691 static void PeerStore(RestApiPostCall& call) |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
692 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
693 ServerContext& context = OrthancRestApi::GetContext(call); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
694 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
695 std::string remote = call.GetUriComponent("id", ""); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
696 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
697 std::list<std::string> instances; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
698 if (!GetInstancesToExport(instances, remote, call)) |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
699 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
700 return; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
701 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
702 |
806 | 703 OrthancPeerParameters peer; |
810
401a9633e492
configuration into a namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
808
diff
changeset
|
704 Configuration::GetOrthancPeer(peer, remote); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
705 |
1007
871c49c9b11d
lua routing is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1000
diff
changeset
|
706 ServerJob job; |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
707 for (std::list<std::string>::const_iterator |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
708 it = instances.begin(); it != instances.end(); ++it) |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
709 { |
1165
0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1142
diff
changeset
|
710 job.AddCommand(new StorePeerCommand(context, peer, false)).AddInput(*it); |
1007
871c49c9b11d
lua routing is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1000
diff
changeset
|
711 } |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
712 |
1007
871c49c9b11d
lua routing is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1000
diff
changeset
|
713 job.SetDescription("HTTP request: POST to peer \"" + remote + "\""); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
714 |
1165
0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1142
diff
changeset
|
715 if (context.GetScheduler().SubmitAndWait(job)) |
0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1142
diff
changeset
|
716 { |
0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1142
diff
changeset
|
717 // Success |
0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1142
diff
changeset
|
718 call.GetOutput().AnswerBuffer("{}", "application/json"); |
0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1142
diff
changeset
|
719 } |
0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1142
diff
changeset
|
720 else |
0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1142
diff
changeset
|
721 { |
0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1142
diff
changeset
|
722 call.GetOutput().SignalError(HttpStatus_500_InternalServerError); |
0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1142
diff
changeset
|
723 } |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
724 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
725 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
726 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
727 // DICOM bridge ------------------------------------------------------------- |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
728 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
729 static bool IsExistingModality(const OrthancRestApi::SetOfStrings& modalities, |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
730 const std::string& id) |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
731 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
732 return modalities.find(id) != modalities.end(); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
733 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
734 |
974 | 735 static void ListModalities(RestApiGetCall& call) |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
736 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
737 OrthancRestApi::SetOfStrings modalities; |
810
401a9633e492
configuration into a namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
808
diff
changeset
|
738 Configuration::GetListOfDicomModalities(modalities); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
739 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
740 Json::Value result = Json::arrayValue; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
741 for (OrthancRestApi::SetOfStrings::const_iterator |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
742 it = modalities.begin(); it != modalities.end(); ++it) |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
743 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
744 result.append(*it); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
745 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
746 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
747 call.GetOutput().AnswerJson(result); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
748 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
749 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
750 |
974 | 751 static void ListModalityOperations(RestApiGetCall& call) |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
752 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
753 OrthancRestApi::SetOfStrings modalities; |
810
401a9633e492
configuration into a namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
808
diff
changeset
|
754 Configuration::GetListOfDicomModalities(modalities); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
755 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
756 std::string id = call.GetUriComponent("id", ""); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
757 if (IsExistingModality(modalities, id)) |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
758 { |
1063
0332e6e8c679
Fix automated generation of the list of resource children in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1049
diff
changeset
|
759 RestApi::AutoListChildren(call); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
760 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
761 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
762 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
763 |
974 | 764 static void UpdateModality(RestApiPutCall& call) |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
765 { |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
766 Json::Value json; |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
767 Json::Reader reader; |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
768 if (reader.parse(call.GetPutBody(), json)) |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
769 { |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
770 RemoteModalityParameters modality; |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
771 modality.FromJson(json); |
812 | 772 Configuration::UpdateModality(call.GetUriComponent("id", ""), modality); |
813 | 773 call.GetOutput().AnswerBuffer("", "text/plain"); |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
774 } |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
775 } |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
776 |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
777 |
974 | 778 static void DeleteModality(RestApiDeleteCall& call) |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
779 { |
810
401a9633e492
configuration into a namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
808
diff
changeset
|
780 Configuration::RemoveModality(call.GetUriComponent("id", "")); |
813 | 781 call.GetOutput().AnswerBuffer("", "text/plain"); |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
782 } |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
783 |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
784 |
974 | 785 static void UpdatePeer(RestApiPutCall& call) |
808
2d9a000aa3a6
update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
807
diff
changeset
|
786 { |
2d9a000aa3a6
update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
807
diff
changeset
|
787 Json::Value json; |
2d9a000aa3a6
update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
807
diff
changeset
|
788 Json::Reader reader; |
2d9a000aa3a6
update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
807
diff
changeset
|
789 if (reader.parse(call.GetPutBody(), json)) |
2d9a000aa3a6
update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
807
diff
changeset
|
790 { |
2d9a000aa3a6
update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
807
diff
changeset
|
791 OrthancPeerParameters peer; |
2d9a000aa3a6
update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
807
diff
changeset
|
792 peer.FromJson(json); |
812 | 793 Configuration::UpdatePeer(call.GetUriComponent("id", ""), peer); |
813 | 794 call.GetOutput().AnswerBuffer("", "text/plain"); |
808
2d9a000aa3a6
update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
807
diff
changeset
|
795 } |
2d9a000aa3a6
update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
807
diff
changeset
|
796 } |
2d9a000aa3a6
update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
807
diff
changeset
|
797 |
2d9a000aa3a6
update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
807
diff
changeset
|
798 |
974 | 799 static void DeletePeer(RestApiDeleteCall& call) |
808
2d9a000aa3a6
update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
807
diff
changeset
|
800 { |
810
401a9633e492
configuration into a namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
808
diff
changeset
|
801 Configuration::RemovePeer(call.GetUriComponent("id", "")); |
813 | 802 call.GetOutput().AnswerBuffer("", "text/plain"); |
808
2d9a000aa3a6
update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
807
diff
changeset
|
803 } |
2d9a000aa3a6
update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
807
diff
changeset
|
804 |
2d9a000aa3a6
update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
807
diff
changeset
|
805 |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
806 void OrthancRestApi::RegisterModalities() |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
807 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
808 Register("/modalities", ListModalities); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
809 Register("/modalities/{id}", ListModalityOperations); |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
810 Register("/modalities/{id}", UpdateModality); |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
811 Register("/modalities/{id}", DeleteModality); |
1049
bd2cb95003da
C-Echo SCU in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1007
diff
changeset
|
812 Register("/modalities/{id}/echo", DicomEcho); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
813 Register("/modalities/{id}/find-patient", DicomFindPatient); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
814 Register("/modalities/{id}/find-study", DicomFindStudy); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
815 Register("/modalities/{id}/find-series", DicomFindSeries); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
816 Register("/modalities/{id}/find-instance", DicomFindInstance); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
817 Register("/modalities/{id}/find", DicomFind); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
818 Register("/modalities/{id}/store", DicomStore); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
819 |
1368 | 820 // For Query/Retrieve |
821 Register("/modalities/{id}/query", DicomQuery); | |
822 Register("/queries", ListQueries); | |
823 Register("/queries/{id}", DeleteQuery); | |
824 Register("/queries/{id}", ListQueryOperations); | |
825 Register("/queries/{id}/answers", ListQueryAnswers); | |
826 Register("/queries/{id}/answers/{index}", ListQueryAnswerOperations); | |
827 Register("/queries/{id}/answers/{index}/content", GetQueryOneAnswer); | |
828 Register("/queries/{id}/answers/{index}/retrieve", RetrieveOneAnswer); | |
829 Register("/queries/{id}/level", GetQueryLevel); | |
830 Register("/queries/{id}/modality", GetQueryModality); | |
831 Register("/queries/{id}/query", GetQueryArguments); | |
832 Register("/queries/{id}/retrieve", RetrieveAllAnswers); | |
833 | |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
834 Register("/peers", ListPeers); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
835 Register("/peers/{id}", ListPeerOperations); |
808
2d9a000aa3a6
update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
807
diff
changeset
|
836 Register("/peers/{id}", UpdatePeer); |
2d9a000aa3a6
update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
807
diff
changeset
|
837 Register("/peers/{id}", DeletePeer); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
838 Register("/peers/{id}/store", PeerStore); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
839 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
840 } |