comparison OrthancServer/OrthancFindRequestHandler.cpp @ 3005:8265a6b56100

DicomMap::FromDicomAsJson
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 12 Dec 2018 15:42:33 +0100
parents 5ae3ff2398e9
children af1530b45290
comparison
equal deleted inserted replaced
3004:80d1a3452807 3005:8265a6b56100
688 * Run the query. 688 * Run the query.
689 **/ 689 **/
690 690
691 size_t limit = (level == ResourceType_Instance) ? maxInstances_ : maxResults_; 691 size_t limit = (level == ResourceType_Instance) ? maxInstances_ : maxResults_;
692 692
693
694 #if 1
695 LookupVisitor visitor(answers, context_, level, *filteredInput, sequencesToReturn); 693 LookupVisitor visitor(answers, context_, level, *filteredInput, sequencesToReturn);
696 context_.Apply(visitor, lookup, 0 /* "since" is not relevant to C-FIND */, limit); 694 context_.Apply(visitor, lookup, 0 /* "since" is not relevant to C-FIND */, limit);
697
698 #else
699 // Backup - Implementation of Orthanc <= 1.5.0
700 // TODO - Remove this code
701
702 // TODO - Use ServerContext::Apply() at this point, in order to
703 // share the code with the "/tools/find" REST URI
704 std::vector<std::string> resources, instances;
705 context_.GetIndex().FindCandidates(resources, instances, lookup);
706
707 LOG(INFO) << "Number of candidate resources after fast DB filtering: " << resources.size();
708
709 assert(resources.size() == instances.size());
710 bool complete = true;
711
712 for (size_t i = 0; i < instances.size(); i++)
713 {
714 // TODO - Don't read the full JSON from the disk if only "main
715 // DICOM tags" are to be returned
716 Json::Value dicom;
717 context_.ReadDicomAsJson(dicom, instances[i]);
718
719 if (lookup.IsMatch(dicom))
720 {
721 if (limit != 0 &&
722 answers.GetSize() >= limit)
723 {
724 complete = false;
725 break;
726 }
727 else
728 {
729 std::auto_ptr<DicomMap> counters(ComputeCounters(context_, instances[i], level, *filteredInput));
730 AddAnswer(answers, dicom, query, sequencesToReturn, counters.get());
731 }
732 }
733 }
734
735 LOG(INFO) << "Number of matching resources: " << answers.GetSize();
736
737 answers.SetComplete(complete);
738 #endif
739 } 695 }
740 696
741 697
742 void OrthancFindRequestHandler::FormatOrigin(Json::Value& origin, 698 void OrthancFindRequestHandler::FormatOrigin(Json::Value& origin,
743 const std::string& remoteIp, 699 const std::string& remoteIp,