comparison OrthancServer/Internals/FindScp.cpp @ 1800:30e97a1f4093 worklists

callback for handling worklists with plugins
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 20 Nov 2015 13:53:20 +0100
parents 4f01c9d73f02
children 4e7c318a3f69
comparison
equal deleted inserted replaced
1799:4f01c9d73f02 1800:30e97a1f4093
100 DicomFindAnswers answers_; 100 DicomFindAnswers answers_;
101 DcmDataset* lastRequest_; 101 DcmDataset* lastRequest_;
102 const std::string* remoteIp_; 102 const std::string* remoteIp_;
103 const std::string* remoteAet_; 103 const std::string* remoteAet_;
104 const std::string* calledAet_; 104 const std::string* calledAet_;
105 bool noCroppingOfResults_;
106 }; 105 };
107 106
108 107
109 void FindScpCallback( 108 void FindScpCallback(
110 /* in */ 109 /* in */
133 if (sopClassUid == UID_FINDModalityWorklistInformationModel) 132 if (sopClassUid == UID_FINDModalityWorklistInformationModel)
134 { 133 {
135 if (data.worklistHandler_ != NULL) 134 if (data.worklistHandler_ != NULL)
136 { 135 {
137 ParsedDicomFile query(*requestIdentifiers); 136 ParsedDicomFile query(*requestIdentifiers);
138 data.noCroppingOfResults_ = data.worklistHandler_->Handle(data.answers_, query, 137 data.worklistHandler_->Handle(data.answers_, query,
139 *data.remoteIp_, *data.remoteAet_, 138 *data.remoteIp_, *data.remoteAet_,
140 *data.calledAet_); 139 *data.calledAet_);
141 ok = true; 140 ok = true;
142 } 141 }
143 else 142 else
144 { 143 {
145 LOG(ERROR) << "No worklist handler is installed, cannot handle this C-FIND request"; 144 LOG(ERROR) << "No worklist handler is installed, cannot handle this C-FIND request";
149 { 148 {
150 if (data.findHandler_ != NULL) 149 if (data.findHandler_ != NULL)
151 { 150 {
152 DicomMap input; 151 DicomMap input;
153 FromDcmtkBridge::Convert(input, *requestIdentifiers); 152 FromDcmtkBridge::Convert(input, *requestIdentifiers);
154 data.noCroppingOfResults_ = data.findHandler_->Handle(data.answers_, input, 153 data.findHandler_->Handle(data.answers_, input,
155 *data.remoteIp_, *data.remoteAet_, 154 *data.remoteIp_, *data.remoteAet_,
156 *data.calledAet_); 155 *data.calledAet_);
157 ok = true; 156 ok = true;
158 } 157 }
159 else 158 else
160 { 159 {
161 LOG(ERROR) << "No C-Find handler is installed, cannot handle this request"; 160 LOG(ERROR) << "No C-Find handler is installed, cannot handle this request";
189 { 188 {
190 // There are pending results that are still to be sent 189 // There are pending results that are still to be sent
191 response->DimseStatus = STATUS_Pending; 190 response->DimseStatus = STATUS_Pending;
192 *responseIdentifiers = data.answers_.ExtractDcmDataset(responseCount - 1); 191 *responseIdentifiers = data.answers_.ExtractDcmDataset(responseCount - 1);
193 } 192 }
194 else if (data.noCroppingOfResults_) 193 else if (data.answers_.IsComplete())
195 { 194 {
196 // Success: All the results have been sent 195 // Success: All the results have been sent
197 response->DimseStatus = STATUS_Success; 196 response->DimseStatus = STATUS_Success;
198 *responseIdentifiers = NULL; 197 *responseIdentifiers = NULL;
199 } 198 }
222 data.findHandler_ = findHandler; 221 data.findHandler_ = findHandler;
223 data.worklistHandler_ = worklistHandler; 222 data.worklistHandler_ = worklistHandler;
224 data.remoteIp_ = &remoteIp; 223 data.remoteIp_ = &remoteIp;
225 data.remoteAet_ = &remoteAet; 224 data.remoteAet_ = &remoteAet;
226 data.calledAet_ = &calledAet; 225 data.calledAet_ = &calledAet;
227 data.noCroppingOfResults_ = true;
228 226
229 OFCondition cond = DIMSE_findProvider(assoc, presID, &msg->msg.CFindRQ, 227 OFCondition cond = DIMSE_findProvider(assoc, presID, &msg->msg.CFindRQ,
230 FindScpCallback, &data, 228 FindScpCallback, &data,
231 /*opt_blockMode*/ DIMSE_BLOCKING, 229 /*opt_blockMode*/ DIMSE_BLOCKING,
232 /*opt_dimse_timeout*/ 0); 230 /*opt_dimse_timeout*/ 0);