comparison OrthancServer/OrthancFindRequestHandler.cpp @ 2876:ae8e72009e64

notes
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 09 Oct 2018 20:09:35 +0200
parents d4fd4614f275
children ce310baccda6
comparison
equal deleted inserted replaced
2875:edfd98a2b6c4 2876:ae8e72009e64
586 586
587 /** 587 /**
588 * Build up the query object. 588 * Build up the query object.
589 **/ 589 **/
590 590
591 LookupResource finder(level); 591 LookupResource lookup(level);
592 592
593 const bool caseSensitivePN = Configuration::GetGlobalBoolParameter("CaseSensitivePN", false); 593 const bool caseSensitivePN = Configuration::GetGlobalBoolParameter("CaseSensitivePN", false);
594 594
595 for (size_t i = 0; i < query.GetSize(); i++) 595 for (size_t i = 0; i < query.GetSize(); i++)
596 { 596 {
621 if (vr == ValueRepresentation_PersonName) 621 if (vr == ValueRepresentation_PersonName)
622 { 622 {
623 sensitive = caseSensitivePN; 623 sensitive = caseSensitivePN;
624 } 624 }
625 625
626 finder.AddDicomConstraint(tag, value, sensitive); 626 lookup.AddDicomConstraint(tag, value, sensitive);
627 } 627 }
628 else 628 else
629 { 629 {
630 LOG(INFO) << "Because of a patch for the manufacturer of the remote modality, " 630 LOG(INFO) << "Because of a patch for the manufacturer of the remote modality, "
631 << "ignoring constraint on tag (" << tag.Format() << ") " << FromDcmtkBridge::GetTagName(element); 631 << "ignoring constraint on tag (" << tag.Format() << ") " << FromDcmtkBridge::GetTagName(element);
635 635
636 /** 636 /**
637 * Run the query. 637 * Run the query.
638 **/ 638 **/
639 639
640 size_t maxResults = (level == ResourceType_Instance) ? maxInstances_ : maxResults_; 640 size_t limit = (level == ResourceType_Instance) ? maxInstances_ : maxResults_;
641 641
642 // TODO - Use ServerContext::Apply() at this point, in order to
643 // share the code with the "/tools/find" REST URI
642 std::vector<std::string> resources, instances; 644 std::vector<std::string> resources, instances;
643 context_.GetIndex().FindCandidates(resources, instances, finder); 645 context_.GetIndex().FindCandidates(resources, instances, lookup);
644 646
645 LOG(INFO) << "Number of candidate resources after fast DB filtering: " << resources.size(); 647 LOG(INFO) << "Number of candidate resources after fast DB filtering: " << resources.size();
646 648
647 assert(resources.size() == instances.size()); 649 assert(resources.size() == instances.size());
648 bool complete = true; 650 bool complete = true;
652 // TODO - Don't read the full JSON from the disk if only "main 654 // TODO - Don't read the full JSON from the disk if only "main
653 // DICOM tags" are to be returned 655 // DICOM tags" are to be returned
654 Json::Value dicom; 656 Json::Value dicom;
655 context_.ReadDicomAsJson(dicom, instances[i]); 657 context_.ReadDicomAsJson(dicom, instances[i]);
656 658
657 if (finder.IsMatch(dicom)) 659 if (lookup.IsMatch(dicom))
658 { 660 {
659 if (maxResults != 0 && 661 if (limit != 0 &&
660 answers.GetSize() >= maxResults) 662 answers.GetSize() >= limit)
661 { 663 {
662 complete = false; 664 complete = false;
663 break; 665 break;
664 } 666 }
665 else 667 else