Mercurial > hg > orthanc
comparison OrthancServer/Sources/OrthancMoveRequestHandler.cpp @ 4165:e34c89e89aac
Fix compatibility with C-MOVE SCU requests issued by Ambra
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 25 Aug 2020 17:05:13 +0200 |
parents | 05b8fd21089c |
children | 067c679626a2 |
comparison
equal
deleted
inserted
replaced
4164:b3c5418109a9 | 4165:e34c89e89aac |
---|---|
203 } | 203 } |
204 }; | 204 }; |
205 } | 205 } |
206 | 206 |
207 | 207 |
208 static bool IsNonEmptyTag(const DicomMap& dicom, | |
209 const DicomTag& tag) | |
210 { | |
211 const DicomValue* value = dicom.TestAndGetValue(tag); | |
212 if (value == NULL || | |
213 value->IsNull() || | |
214 value->IsBinary()) | |
215 { | |
216 return false; | |
217 } | |
218 else | |
219 { | |
220 return !value->GetContent().empty(); | |
221 } | |
222 } | |
223 | |
224 | |
208 bool OrthancMoveRequestHandler::LookupIdentifiers(std::vector<std::string>& publicIds, | 225 bool OrthancMoveRequestHandler::LookupIdentifiers(std::vector<std::string>& publicIds, |
209 ResourceType level, | 226 ResourceType level, |
210 const DicomMap& input) | 227 const DicomMap& input) |
211 { | 228 { |
212 DicomTag tag(0, 0); // Dummy initialization | 229 DicomTag tag(0, 0); // Dummy initialization |
216 case ResourceType_Patient: | 233 case ResourceType_Patient: |
217 tag = DICOM_TAG_PATIENT_ID; | 234 tag = DICOM_TAG_PATIENT_ID; |
218 break; | 235 break; |
219 | 236 |
220 case ResourceType_Study: | 237 case ResourceType_Study: |
221 tag = (input.HasTag(DICOM_TAG_ACCESSION_NUMBER) ? | 238 // The test below using "IsNonEmptyTag()" fixes compatibility |
222 DICOM_TAG_ACCESSION_NUMBER : DICOM_TAG_STUDY_INSTANCE_UID); | 239 // with Ambra C-FIND SCU: |
240 // https://groups.google.com/g/orthanc-users/c/yIUnZ9v9-Zs/m/GQPXiAOiCQAJ | |
241 if (IsNonEmptyTag(input, DICOM_TAG_ACCESSION_NUMBER)) | |
242 { | |
243 tag = DICOM_TAG_ACCESSION_NUMBER; | |
244 } | |
245 else | |
246 { | |
247 tag = DICOM_TAG_STUDY_INSTANCE_UID; | |
248 } | |
223 break; | 249 break; |
224 | 250 |
225 case ResourceType_Series: | 251 case ResourceType_Series: |
226 tag = DICOM_TAG_SERIES_INSTANCE_UID; | 252 tag = DICOM_TAG_SERIES_INSTANCE_UID; |
227 break; | 253 break; |
371 { | 397 { |
372 return CreateIterator(context_, targetAet, publicIds, originatorAet, originatorId); | 398 return CreateIterator(context_, targetAet, publicIds, originatorAet, originatorId); |
373 } | 399 } |
374 else | 400 else |
375 { | 401 { |
376 throw OrthancException(ErrorCode_BadRequest, "Invalid fields in a C-MOVE request"); | 402 throw OrthancException(ErrorCode_BadRequest, "No DICOM identifier provided in the C-MOVE request for this query retrieve level"); |
377 } | 403 } |
378 } | 404 } |
379 } | 405 } |