comparison OrthancServer/OrthancRestApi/OrthancRestModalities.cpp @ 3874:2effa961f67f transcoding

forcing use of DicomAssociationParameters if creating an SCU
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 30 Apr 2020 15:00:20 +0200
parents 09798f2b985f
children ea1d32861cfc
comparison
equal deleted inserted replaced
3873:ae5bdde751fd 3874:2effa961f67f
84 call.ParseJsonRequest(request); 84 call.ParseJsonRequest(request);
85 int timeout = Toolbox::GetJsonIntegerField(request, "Timeout", -1); 85 int timeout = Toolbox::GetJsonIntegerField(request, "Timeout", -1);
86 86
87 try 87 try
88 { 88 {
89 DicomControlUserConnection connection(localAet, remote); 89 DicomAssociationParameters params(localAet, remote);
90 DicomControlUserConnection connection(params);
90 91
91 // New in Orthanc 1.7.0 92 // New in Orthanc 1.7.0
92 if (timeout != -1) 93 if (timeout != -1)
93 { 94 {
94 connection.SetTimeout(timeout); 95 connection.SetTimeout(timeout);
212 MyGetModalityUsingSymbolicName(call.GetUriComponent("id", "")); 213 MyGetModalityUsingSymbolicName(call.GetUriComponent("id", ""));
213 214
214 DicomFindAnswers answers(false); 215 DicomFindAnswers answers(false);
215 216
216 { 217 {
217 DicomControlUserConnection connection(localAet, remote); 218 DicomAssociationParameters params(localAet, remote);
219 DicomControlUserConnection connection(params);
218 FindPatient(answers, connection, fields); 220 FindPatient(answers, connection, fields);
219 } 221 }
220 222
221 Json::Value result; 223 Json::Value result;
222 answers.ToJson(result, true); 224 answers.ToJson(result, true);
246 MyGetModalityUsingSymbolicName(call.GetUriComponent("id", "")); 248 MyGetModalityUsingSymbolicName(call.GetUriComponent("id", ""));
247 249
248 DicomFindAnswers answers(false); 250 DicomFindAnswers answers(false);
249 251
250 { 252 {
251 DicomControlUserConnection connection(localAet, remote); 253 DicomAssociationParameters params(localAet, remote);
254 DicomControlUserConnection connection(params);
252 FindStudy(answers, connection, fields); 255 FindStudy(answers, connection, fields);
253 } 256 }
254 257
255 Json::Value result; 258 Json::Value result;
256 answers.ToJson(result, true); 259 answers.ToJson(result, true);
281 MyGetModalityUsingSymbolicName(call.GetUriComponent("id", "")); 284 MyGetModalityUsingSymbolicName(call.GetUriComponent("id", ""));
282 285
283 DicomFindAnswers answers(false); 286 DicomFindAnswers answers(false);
284 287
285 { 288 {
286 DicomControlUserConnection connection(localAet, remote); 289 DicomAssociationParameters params(localAet, remote);
290 DicomControlUserConnection connection(params);
287 FindSeries(answers, connection, fields); 291 FindSeries(answers, connection, fields);
288 } 292 }
289 293
290 Json::Value result; 294 Json::Value result;
291 answers.ToJson(result, true); 295 answers.ToJson(result, true);
317 MyGetModalityUsingSymbolicName(call.GetUriComponent("id", "")); 321 MyGetModalityUsingSymbolicName(call.GetUriComponent("id", ""));
318 322
319 DicomFindAnswers answers(false); 323 DicomFindAnswers answers(false);
320 324
321 { 325 {
322 DicomControlUserConnection connection(localAet, remote); 326 DicomAssociationParameters params(localAet, remote);
327 DicomControlUserConnection connection(params);
323 FindInstance(answers, connection, fields); 328 FindInstance(answers, connection, fields);
324 } 329 }
325 330
326 Json::Value result; 331 Json::Value result;
327 answers.ToJson(result, true); 332 answers.ToJson(result, true);
355 360
356 const std::string& localAet = context.GetDefaultLocalApplicationEntityTitle(); 361 const std::string& localAet = context.GetDefaultLocalApplicationEntityTitle();
357 RemoteModalityParameters remote = 362 RemoteModalityParameters remote =
358 MyGetModalityUsingSymbolicName(call.GetUriComponent("id", "")); 363 MyGetModalityUsingSymbolicName(call.GetUriComponent("id", ""));
359 364
360 DicomControlUserConnection connection(localAet, remote); 365 DicomAssociationParameters params(localAet, remote);
366 DicomControlUserConnection connection(params);
361 367
362 DicomFindAnswers patients(false); 368 DicomFindAnswers patients(false);
363 FindPatient(patients, connection, m); 369 FindPatient(patients, connection, m);
364 370
365 // Loop over the found patients 371 // Loop over the found patients
1004 1010
1005 const std::string& localAet = context.GetDefaultLocalApplicationEntityTitle(); 1011 const std::string& localAet = context.GetDefaultLocalApplicationEntityTitle();
1006 RemoteModalityParameters remote = 1012 RemoteModalityParameters remote =
1007 MyGetModalityUsingSymbolicName(call.GetUriComponent("id", "")); 1013 MyGetModalityUsingSymbolicName(call.GetUriComponent("id", ""));
1008 1014
1009 DicomStoreUserConnection connection(localAet, remote); 1015 DicomAssociationParameters params(localAet, remote);
1016 DicomStoreUserConnection connection(params);
1010 1017
1011 std::string sopClassUid, sopInstanceUid; 1018 std::string sopClassUid, sopInstanceUid;
1012 connection.Store(sopClassUid, sopInstanceUid, 1019 connection.Store(sopClassUid, sopInstanceUid,
1013 call.GetBodyData(), call.GetBodySize()); 1020 call.GetBodyData(), call.GetBodySize());
1014 1021
1051 (request, "Timeout", -1); 1058 (request, "Timeout", -1);
1052 1059
1053 const RemoteModalityParameters source = 1060 const RemoteModalityParameters source =
1054 MyGetModalityUsingSymbolicName(call.GetUriComponent("id", "")); 1061 MyGetModalityUsingSymbolicName(call.GetUriComponent("id", ""));
1055 1062
1056 DicomControlUserConnection connection(localAet, source); 1063 DicomAssociationParameters params(localAet, source);
1064 DicomControlUserConnection connection(params);
1057 1065
1058 if (timeout > -1) 1066 if (timeout > -1)
1059 { 1067 {
1060 connection.SetTimeout(timeout); 1068 connection.SetTimeout(timeout);
1061 } 1069 }
1339 "" /* no private creator */)); 1347 "" /* no private creator */));
1340 1348
1341 DicomFindAnswers answers(true); 1349 DicomFindAnswers answers(true);
1342 1350
1343 { 1351 {
1344 DicomControlUserConnection connection(localAet, remote); 1352 DicomAssociationParameters params(localAet, remote);
1353 DicomControlUserConnection connection(params);
1345 connection.FindWorklist(answers, *query); 1354 connection.FindWorklist(answers, *query);
1346 } 1355 }
1347 1356
1348 Json::Value result; 1357 Json::Value result;
1349 answers.ToJson(result, true); 1358 answers.ToJson(result, true);