comparison OrthancServer/OrthancRestApi.cpp @ 613:60d90e48e809 find-move-scp

query/retrieve
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 18 Oct 2013 17:27:26 +0200
parents d5043ff68d58
children fb49bf72ac2d
comparison
equal deleted inserted replaced
612:fdd5f7f9c4d7 613:60d90e48e809
69 static boost::mutex cacheMutex_; 69 static boost::mutex cacheMutex_;
70 70
71 71
72 // DICOM SCU ---------------------------------------------------------------- 72 // DICOM SCU ----------------------------------------------------------------
73 73
74 static void ConnectToModality(DicomUserConnection& connection,
75 const std::string& name)
76 {
77 std::string aet, address;
78 int port;
79 ModalityManufacturer manufacturer;
80 GetDicomModality(name, aet, address, port, manufacturer);
81 connection.SetLocalApplicationEntityTitle(GetGlobalStringParameter("DicomAet", "ORTHANC"));
82 connection.SetDistantApplicationEntityTitle(aet);
83 connection.SetDistantHost(address);
84 connection.SetDistantPort(port);
85 connection.SetDistantManufacturer(manufacturer);
86 connection.Open();
87 }
88
89 static bool MergeQueryAndTemplate(DicomMap& result, 74 static bool MergeQueryAndTemplate(DicomMap& result,
90 const std::string& postData) 75 const std::string& postData)
91 { 76 {
92 Json::Value query; 77 Json::Value query;
93 Json::Reader reader; 78 Json::Reader reader;
116 { 101 {
117 return; 102 return;
118 } 103 }
119 104
120 DicomUserConnection connection; 105 DicomUserConnection connection;
121 ConnectToModality(connection, call.GetUriComponent("id", "")); 106 ConnectToModalityUsingSymbolicName(connection, call.GetUriComponent("id", ""));
122 107
123 DicomFindAnswers answers; 108 DicomFindAnswers answers;
124 connection.FindPatient(answers, m); 109 connection.FindPatient(answers, m);
125 110
126 Json::Value result; 111 Json::Value result;
142 { 127 {
143 return; 128 return;
144 } 129 }
145 130
146 DicomUserConnection connection; 131 DicomUserConnection connection;
147 ConnectToModality(connection, call.GetUriComponent("id", "")); 132 ConnectToModalityUsingSymbolicName(connection, call.GetUriComponent("id", ""));
148 133
149 DicomFindAnswers answers; 134 DicomFindAnswers answers;
150 connection.FindStudy(answers, m); 135 connection.FindStudy(answers, m);
151 136
152 Json::Value result; 137 Json::Value result;
169 { 154 {
170 return; 155 return;
171 } 156 }
172 157
173 DicomUserConnection connection; 158 DicomUserConnection connection;
174 ConnectToModality(connection, call.GetUriComponent("id", "")); 159 ConnectToModalityUsingSymbolicName(connection, call.GetUriComponent("id", ""));
175 160
176 DicomFindAnswers answers; 161 DicomFindAnswers answers;
177 connection.FindSeries(answers, m); 162 connection.FindSeries(answers, m);
178 163
179 Json::Value result; 164 Json::Value result;
197 { 182 {
198 return; 183 return;
199 } 184 }
200 185
201 DicomUserConnection connection; 186 DicomUserConnection connection;
202 ConnectToModality(connection, call.GetUriComponent("id", "")); 187 ConnectToModalityUsingSymbolicName(connection, call.GetUriComponent("id", ""));
203 188
204 DicomFindAnswers answers; 189 DicomFindAnswers answers;
205 connection.FindInstance(answers, m); 190 connection.FindInstance(answers, m);
206 191
207 Json::Value result; 192 Json::Value result;
217 { 202 {
218 return; 203 return;
219 } 204 }
220 205
221 DicomUserConnection connection; 206 DicomUserConnection connection;
222 ConnectToModality(connection, call.GetUriComponent("id", "")); 207 ConnectToModalityUsingSymbolicName(connection, call.GetUriComponent("id", ""));
223 208
224 DicomFindAnswers patients; 209 DicomFindAnswers patients;
225 connection.FindPatient(patients, m); 210 connection.FindPatient(patients, m);
226 211
227 // Loop over the found patients 212 // Loop over the found patients
348 { 333 {
349 return; 334 return;
350 } 335 }
351 336
352 DicomUserConnection connection; 337 DicomUserConnection connection;
353 ConnectToModality(connection, remote); 338 ConnectToModalityUsingSymbolicName(connection, remote);
354 339
355 for (std::list<std::string>::const_iterator 340 for (std::list<std::string>::const_iterator
356 it = instances.begin(); it != instances.end(); it++) 341 it = instances.begin(); it != instances.end(); it++)
357 { 342 {
358 LOG(INFO) << "Sending resource " << *it << " to modality \"" << remote << "\""; 343 LOG(INFO) << "Sending resource " << *it << " to modality \"" << remote << "\"";