# HG changeset patch # User Sebastien Jodogne # Date 1715433082 -7200 # Node ID 4bfd885fb45f805c7f23fe720b787fc002632087 # Parent 1864b16bc7b1790da7b72cf815c5546df56171b3 optimization as patient-level tags are copied at study level diff -r 1864b16bc7b1 -r 4bfd885fb45f OrthancServer/Sources/ResourceFinder.cpp --- a/OrthancServer/Sources/ResourceFinder.cpp Sat May 11 12:13:31 2024 +0200 +++ b/OrthancServer/Sources/ResourceFinder.cpp Sat May 11 15:11:22 2024 +0200 @@ -397,9 +397,22 @@ { if (DicomMap::IsMainDicomTag(tag, ResourceType_Patient)) { - request_.GetParentRetrieveSpecification(ResourceType_Patient).SetRetrieveMainDicomTags(true); - request_.GetParentRetrieveSpecification(ResourceType_Patient).SetRetrieveMetadata(true); - requestedPatientTags_.insert(tag); + if (request_.GetLevel() == ResourceType_Patient) + { + request_.GetParentRetrieveSpecification(ResourceType_Patient).SetRetrieveMainDicomTags(true); + request_.GetParentRetrieveSpecification(ResourceType_Patient).SetRetrieveMetadata(true); + requestedPatientTags_.insert(tag); + } + else + { + /** + * This comes from the fact that patient-level tags are copied + * at the study level, as implemented by "ResourcesContent::AddResource()". + **/ + request_.GetParentRetrieveSpecification(ResourceType_Study).SetRetrieveMainDicomTags(true); + request_.GetParentRetrieveSpecification(ResourceType_Study).SetRetrieveMetadata(true); + requestedStudyTags_.insert(tag); + } } else if (DicomMap::IsMainDicomTag(tag, ResourceType_Study)) {