comparison OrthancServer/Sources/OrthancFindRequestHandler.cpp @ 4143:1ec3e1e18f50

Add missing tag "Retrieve AE Title (0008,0054)" in C-FIND SCP responses
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 14 Aug 2020 08:19:02 +0200
parents c02a2d9efbc2
children 318c16cfccab
comparison
equal deleted inserted replaced
4142:0ea450e1f0ea 4143:1ec3e1e18f50
302 const Json::Value* dicomAsJson, 302 const Json::Value* dicomAsJson,
303 const DicomArray& query, 303 const DicomArray& query,
304 const std::list<DicomTag>& sequencesToReturn, 304 const std::list<DicomTag>& sequencesToReturn,
305 const DicomMap* counters, 305 const DicomMap* counters,
306 const std::string& defaultPrivateCreator, 306 const std::string& defaultPrivateCreator,
307 const std::map<uint16_t, std::string>& privateCreators) 307 const std::map<uint16_t, std::string>& privateCreators,
308 const std::string& retrieveAet)
308 { 309 {
309 DicomMap match; 310 DicomMap match;
310 311
311 if (dicomAsJson != NULL) 312 if (dicomAsJson != NULL)
312 { 313 {
316 { 317 {
317 match.Assign(mainDicomTags); 318 match.Assign(mainDicomTags);
318 } 319 }
319 320
320 DicomMap result; 321 DicomMap result;
322
323 /**
324 * Add the mandatory "Retrieve AE Title (0008,0054)" tag, which was missing in Orthanc <= 1.7.2.
325 * http://dicom.nema.org/medical/dicom/current/output/html/part04.html#sect_C.4.1.1.3.2
326 * https://groups.google.com/g/orthanc-users/c/-7zNTKR_PMU/m/kfjwzEVNAgAJ
327 **/
328 result.SetValue(DICOM_TAG_RETRIEVE_AE_TITLE, retrieveAet, false /* not binary */);
321 329
322 for (size_t i = 0; i < query.GetSize(); i++) 330 for (size_t i = 0; i < query.GetSize(); i++)
323 { 331 {
324 if (query.GetElement(i).GetTag() == DICOM_TAG_QUERY_RETRIEVE_LEVEL) 332 if (query.GetElement(i).GetTag() == DICOM_TAG_QUERY_RETRIEVE_LEVEL)
325 { 333 {
502 const DicomMap& query_; 510 const DicomMap& query_;
503 DicomArray queryAsArray_; 511 DicomArray queryAsArray_;
504 const std::list<DicomTag>& sequencesToReturn_; 512 const std::list<DicomTag>& sequencesToReturn_;
505 std::string defaultPrivateCreator_; // the private creator to use if the group is not defined in the query itself 513 std::string defaultPrivateCreator_; // the private creator to use if the group is not defined in the query itself
506 const std::map<uint16_t, std::string>& privateCreators_; // the private creators defined in the query itself 514 const std::map<uint16_t, std::string>& privateCreators_; // the private creators defined in the query itself
515 std::string retrieveAet_;
507 516
508 public: 517 public:
509 LookupVisitor(DicomFindAnswers& answers, 518 LookupVisitor(DicomFindAnswers& answers,
510 ServerContext& context, 519 ServerContext& context,
511 ResourceType level, 520 ResourceType level,
523 answers_.SetComplete(false); 532 answers_.SetComplete(false);
524 533
525 { 534 {
526 OrthancConfiguration::ReaderLock lock; 535 OrthancConfiguration::ReaderLock lock;
527 defaultPrivateCreator_ = lock.GetConfiguration().GetDefaultPrivateCreator(); 536 defaultPrivateCreator_ = lock.GetConfiguration().GetDefaultPrivateCreator();
537 retrieveAet_ = lock.GetConfiguration().GetOrthancAET();
528 } 538 }
529 } 539 }
530 540
531 virtual bool IsDicomAsJsonNeeded() const 541 virtual bool IsDicomAsJsonNeeded() const
532 { 542 {
564 const DicomMap& mainDicomTags, 574 const DicomMap& mainDicomTags,
565 const Json::Value* dicomAsJson) 575 const Json::Value* dicomAsJson)
566 { 576 {
567 std::unique_ptr<DicomMap> counters(ComputeCounters(context_, instanceId, level_, query_)); 577 std::unique_ptr<DicomMap> counters(ComputeCounters(context_, instanceId, level_, query_));
568 578
569 AddAnswer(answers_, mainDicomTags, dicomAsJson, 579 AddAnswer(answers_, mainDicomTags, dicomAsJson, queryAsArray_, sequencesToReturn_,
570 queryAsArray_, sequencesToReturn_, counters.get(), defaultPrivateCreator_, privateCreators_); 580 counters.get(), defaultPrivateCreator_, privateCreators_, retrieveAet_);
571 } 581 }
572 }; 582 };
573 583
574 584
575 void OrthancFindRequestHandler::Handle(DicomFindAnswers& answers, 585 void OrthancFindRequestHandler::Handle(DicomFindAnswers& answers,