comparison OrthancServer/OrthancRestApi/OrthancRestModalities.cpp @ 3401:962e5f00744b

cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 07 Jun 2019 14:58:27 +0200
parents d0d6bd633e4c
children de1665e7b341
comparison
equal deleted inserted replaced
3400:0faae6f6e3c5 3401:962e5f00744b
100 /*************************************************************************** 100 /***************************************************************************
101 * DICOM C-Find SCU => DEPRECATED! 101 * DICOM C-Find SCU => DEPRECATED!
102 ***************************************************************************/ 102 ***************************************************************************/
103 103
104 static bool MergeQueryAndTemplate(DicomMap& result, 104 static bool MergeQueryAndTemplate(DicomMap& result,
105 const char* postData, 105 const RestApiCall& call)
106 size_t postSize)
107 { 106 {
108 Json::Value query; 107 Json::Value query;
109 Json::Reader reader; 108
110 109 if (!call.ParseJsonRequest(query) ||
111 if (!reader.parse(postData, postData + postSize, query) ||
112 query.type() != Json::objectValue) 110 query.type() != Json::objectValue)
113 { 111 {
114 return false; 112 return false;
115 } 113 }
116 114
188 LOG(WARNING) << "This URI is deprecated: " << call.FlattenUri(); 186 LOG(WARNING) << "This URI is deprecated: " << call.FlattenUri();
189 ServerContext& context = OrthancRestApi::GetContext(call); 187 ServerContext& context = OrthancRestApi::GetContext(call);
190 188
191 DicomMap fields; 189 DicomMap fields;
192 DicomMap::SetupFindPatientTemplate(fields); 190 DicomMap::SetupFindPatientTemplate(fields);
193 if (!MergeQueryAndTemplate(fields, call.GetBodyData(), call.GetBodySize())) 191 if (!MergeQueryAndTemplate(fields, call))
194 { 192 {
195 return; 193 return;
196 } 194 }
197 195
198 const std::string& localAet = context.GetDefaultLocalApplicationEntityTitle(); 196 const std::string& localAet = context.GetDefaultLocalApplicationEntityTitle();
217 LOG(WARNING) << "This URI is deprecated: " << call.FlattenUri(); 215 LOG(WARNING) << "This URI is deprecated: " << call.FlattenUri();
218 ServerContext& context = OrthancRestApi::GetContext(call); 216 ServerContext& context = OrthancRestApi::GetContext(call);
219 217
220 DicomMap fields; 218 DicomMap fields;
221 DicomMap::SetupFindStudyTemplate(fields); 219 DicomMap::SetupFindStudyTemplate(fields);
222 if (!MergeQueryAndTemplate(fields, call.GetBodyData(), call.GetBodySize())) 220 if (!MergeQueryAndTemplate(fields, call))
223 { 221 {
224 return; 222 return;
225 } 223 }
226 224
227 if (fields.GetValue(DICOM_TAG_ACCESSION_NUMBER).GetContent().size() <= 2 && 225 if (fields.GetValue(DICOM_TAG_ACCESSION_NUMBER).GetContent().size() <= 2 &&
252 LOG(WARNING) << "This URI is deprecated: " << call.FlattenUri(); 250 LOG(WARNING) << "This URI is deprecated: " << call.FlattenUri();
253 ServerContext& context = OrthancRestApi::GetContext(call); 251 ServerContext& context = OrthancRestApi::GetContext(call);
254 252
255 DicomMap fields; 253 DicomMap fields;
256 DicomMap::SetupFindSeriesTemplate(fields); 254 DicomMap::SetupFindSeriesTemplate(fields);
257 if (!MergeQueryAndTemplate(fields, call.GetBodyData(), call.GetBodySize())) 255 if (!MergeQueryAndTemplate(fields, call))
258 { 256 {
259 return; 257 return;
260 } 258 }
261 259
262 if ((fields.GetValue(DICOM_TAG_ACCESSION_NUMBER).GetContent().size() <= 2 && 260 if ((fields.GetValue(DICOM_TAG_ACCESSION_NUMBER).GetContent().size() <= 2 &&
288 LOG(WARNING) << "This URI is deprecated: " << call.FlattenUri(); 286 LOG(WARNING) << "This URI is deprecated: " << call.FlattenUri();
289 ServerContext& context = OrthancRestApi::GetContext(call); 287 ServerContext& context = OrthancRestApi::GetContext(call);
290 288
291 DicomMap fields; 289 DicomMap fields;
292 DicomMap::SetupFindInstanceTemplate(fields); 290 DicomMap::SetupFindInstanceTemplate(fields);
293 if (!MergeQueryAndTemplate(fields, call.GetBodyData(), call.GetBodySize())) 291 if (!MergeQueryAndTemplate(fields, call))
294 { 292 {
295 return; 293 return;
296 } 294 }
297 295
298 if ((fields.GetValue(DICOM_TAG_ACCESSION_NUMBER).GetContent().size() <= 2 && 296 if ((fields.GetValue(DICOM_TAG_ACCESSION_NUMBER).GetContent().size() <= 2 &&
338 LOG(WARNING) << "This URI is deprecated: " << call.FlattenUri(); 336 LOG(WARNING) << "This URI is deprecated: " << call.FlattenUri();
339 ServerContext& context = OrthancRestApi::GetContext(call); 337 ServerContext& context = OrthancRestApi::GetContext(call);
340 338
341 DicomMap m; 339 DicomMap m;
342 DicomMap::SetupFindPatientTemplate(m); 340 DicomMap::SetupFindPatientTemplate(m);
343 if (!MergeQueryAndTemplate(m, call.GetBodyData(), call.GetBodySize())) 341 if (!MergeQueryAndTemplate(m, call))
344 { 342 {
345 return; 343 return;
346 } 344 }
347 345
348 const std::string& localAet = context.GetDefaultLocalApplicationEntityTitle(); 346 const std::string& localAet = context.GetDefaultLocalApplicationEntityTitle();
361 { 359 {
362 Json::Value patient; 360 Json::Value patient;
363 patients.ToJson(patient, i, true); 361 patients.ToJson(patient, i, true);
364 362
365 DicomMap::SetupFindStudyTemplate(m); 363 DicomMap::SetupFindStudyTemplate(m);
366 if (!MergeQueryAndTemplate(m, call.GetBodyData(), call.GetBodySize())) 364 if (!MergeQueryAndTemplate(m, call))
367 { 365 {
368 return; 366 return;
369 } 367 }
370 368
371 CopyTagIfExists(m, patients.GetAnswer(i), DICOM_TAG_PATIENT_ID); 369 CopyTagIfExists(m, patients.GetAnswer(i), DICOM_TAG_PATIENT_ID);
380 { 378 {
381 Json::Value study; 379 Json::Value study;
382 studies.ToJson(study, j, true); 380 studies.ToJson(study, j, true);
383 381
384 DicomMap::SetupFindSeriesTemplate(m); 382 DicomMap::SetupFindSeriesTemplate(m);
385 if (!MergeQueryAndTemplate(m, call.GetBodyData(), call.GetBodySize())) 383 if (!MergeQueryAndTemplate(m, call))
386 { 384 {
387 return; 385 return;
388 } 386 }
389 387
390 CopyTagIfExists(m, studies.GetAnswer(j), DICOM_TAG_PATIENT_ID); 388 CopyTagIfExists(m, studies.GetAnswer(j), DICOM_TAG_PATIENT_ID);
1167 static void UpdateModality(RestApiPutCall& call) 1165 static void UpdateModality(RestApiPutCall& call)
1168 { 1166 {
1169 ServerContext& context = OrthancRestApi::GetContext(call); 1167 ServerContext& context = OrthancRestApi::GetContext(call);
1170 1168
1171 Json::Value json; 1169 Json::Value json;
1172 Json::Reader reader; 1170 if (call.ParseJsonRequest(json))
1173 if (reader.parse(call.GetBodyData(), call.GetBodyData() + call.GetBodySize(), json))
1174 { 1171 {
1175 RemoteModalityParameters modality; 1172 RemoteModalityParameters modality;
1176 modality.Unserialize(json); 1173 modality.Unserialize(json);
1177 1174
1178 { 1175 {
1205 static void UpdatePeer(RestApiPutCall& call) 1202 static void UpdatePeer(RestApiPutCall& call)
1206 { 1203 {
1207 ServerContext& context = OrthancRestApi::GetContext(call); 1204 ServerContext& context = OrthancRestApi::GetContext(call);
1208 1205
1209 Json::Value json; 1206 Json::Value json;
1210 Json::Reader reader; 1207 if (call.ParseJsonRequest(json))
1211 if (reader.parse(call.GetBodyData(), call.GetBodyData() + call.GetBodySize(), json))
1212 { 1208 {
1213 WebServiceParameters peer; 1209 WebServiceParameters peer;
1214 peer.Unserialize(json); 1210 peer.Unserialize(json);
1215 1211
1216 { 1212 {