comparison OrthancServer/Internals/FindScp.cpp @ 2381:b8969010b534

uncoupling DCMTK primitives from Orthanc::Configuration
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 29 Aug 2017 19:59:01 +0200
parents de1ba22fd28a
children
comparison
equal deleted inserted replaced
2380:96b3ec054b69 2381:b8969010b534
137 { 137 {
138 namespace 138 namespace
139 { 139 {
140 struct FindScpData 140 struct FindScpData
141 { 141 {
142 DicomServer::IRemoteModalities* modalities_;
142 IFindRequestHandler* findHandler_; 143 IFindRequestHandler* findHandler_;
143 IWorklistRequestHandler* worklistHandler_; 144 IWorklistRequestHandler* worklistHandler_;
144 DicomFindAnswers answers_; 145 DicomFindAnswers answers_;
145 DcmDataset* lastRequest_; 146 DcmDataset* lastRequest_;
146 const std::string* remoteIp_; 147 const std::string* remoteIp_;
195 196
196 /** 197 /**
197 * Ensure that the remote modality is known to Orthanc for C-FIND requests. 198 * Ensure that the remote modality is known to Orthanc for C-FIND requests.
198 **/ 199 **/
199 200
200 if (!Configuration::LookupDicomModalityUsingAETitle(modality, *data.remoteAet_)) 201 assert(data.modalities_ != NULL);
202 if (!data.modalities_->LookupAETitle(modality, *data.remoteAet_))
201 { 203 {
202 LOG(ERROR) << "Modality with AET \"" << *data.remoteAet_ 204 LOG(ERROR) << "Modality with AET \"" << *data.remoteAet_
203 << "\" is not defined in the \"DicomModalities\" configuration option"; 205 << "\" is not defined in the \"DicomModalities\" configuration option";
204 throw OrthancException(ErrorCode_UnknownModality); 206 throw OrthancException(ErrorCode_UnknownModality);
205 } 207 }
250 sequencesToReturn.push_back(tag); 252 sequencesToReturn.push_back(tag);
251 } 253 }
252 } 254 }
253 255
254 DicomMap input; 256 DicomMap input;
255 Configuration::ExtractDicomSummary(input, *requestIdentifiers); 257 FromDcmtkBridge::ExtractDicomSummary(input, *requestIdentifiers);
256 258
257 data.findHandler_->Handle(data.answers_, input, sequencesToReturn, 259 data.findHandler_->Handle(data.answers_, input, sequencesToReturn,
258 *data.remoteIp_, *data.remoteAet_, 260 *data.remoteIp_, *data.remoteAet_,
259 *data.calledAet_, modality.GetManufacturer()); 261 *data.calledAet_, modality.GetManufacturer());
260 ok = true; 262 ok = true;
312 314
313 315
314 OFCondition Internals::findScp(T_ASC_Association * assoc, 316 OFCondition Internals::findScp(T_ASC_Association * assoc,
315 T_DIMSE_Message * msg, 317 T_DIMSE_Message * msg,
316 T_ASC_PresentationContextID presID, 318 T_ASC_PresentationContextID presID,
319 DicomServer::IRemoteModalities& modalities,
317 IFindRequestHandler* findHandler, 320 IFindRequestHandler* findHandler,
318 IWorklistRequestHandler* worklistHandler, 321 IWorklistRequestHandler* worklistHandler,
319 const std::string& remoteIp, 322 const std::string& remoteIp,
320 const std::string& remoteAet, 323 const std::string& remoteAet,
321 const std::string& calledAet) 324 const std::string& calledAet)
322 { 325 {
323 FindScpData data; 326 FindScpData data;
324 data.lastRequest_ = NULL; 327 data.modalities_ = &modalities;
325 data.findHandler_ = findHandler; 328 data.findHandler_ = findHandler;
326 data.worklistHandler_ = worklistHandler; 329 data.worklistHandler_ = worklistHandler;
330 data.lastRequest_ = NULL;
327 data.remoteIp_ = &remoteIp; 331 data.remoteIp_ = &remoteIp;
328 data.remoteAet_ = &remoteAet; 332 data.remoteAet_ = &remoteAet;
329 data.calledAet_ = &calledAet; 333 data.calledAet_ = &calledAet;
330 334
331 OFCondition cond = DIMSE_findProvider(assoc, presID, &msg->msg.CFindRQ, 335 OFCondition cond = DIMSE_findProvider(assoc, presID, &msg->msg.CFindRQ,