Mercurial > hg > orthanc
diff OrthancServer/Sources/ServerContext.cpp @ 4936:8422e4f99a18 more-tags
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
author | Alain Mazy <am@osimis.io> |
---|---|
date | Fri, 11 Mar 2022 17:38:16 +0100 |
parents | acd3f72e2a21 |
children | 3f9b9865c8cc |
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerContext.cpp Thu Mar 10 19:00:43 2022 +0100 +++ b/OrthancServer/Sources/ServerContext.cpp Fri Mar 11 17:38:16 2022 +0100 @@ -2096,7 +2096,8 @@ static void SerializeExpandedResource(Json::Value& target, const ExpandedResource& resource, - DicomToJsonFormat format) + DicomToJsonFormat format, + const std::set<DicomTag>& requestedTags) { target = Json::objectValue; @@ -2241,17 +2242,29 @@ FromDcmtkBridge::ToJson(target[PATIENT_MAIN_DICOM_TAGS], patientMainDicomTags, format); } + if (requestedTags.size() > 0) + { + static const char* const REQUESTED_TAGS = "RequestedTags"; + + DicomMap tags; + resource.tags_.ExtractTags(tags, requestedTags); + + target[REQUESTED_TAGS] = Json::objectValue; + FromDcmtkBridge::ToJson(target[REQUESTED_TAGS], tags, format); + } + } bool ServerContext::ExpandResource(Json::Value& target, const std::string& publicId, ResourceType level, - DicomToJsonFormat format) + DicomToJsonFormat format, + const std::set<DicomTag>& requestedTags) { ExpandedResource resource; - if (GetIndex().ExpandResource(resource, publicId, level, format)) + if (GetIndex().ExpandResource(resource, publicId, level, format, requestedTags)) { // check the main dicom tags list has not changed since the resource was stored @@ -2260,13 +2273,15 @@ OrthancConfiguration::ReaderLock lock; if (lock.GetConfiguration().IsInconsistentDicomTagsLogsEnabled()) { - LOG(WARNING) << Orthanc::GetResourceTypeText(resource.type_, false , false) << " has been stored with another version of Main Dicom Tags list, you should POST to /" << Orthanc::GetResourceTypeText(resource.type_, true, false) << "/" << resource.id_ << "/reconstruct to update the list of tags saved in DB. Some tags might be missing from this answer."; + LOG(WARNING) << Orthanc::GetResourceTypeText(resource.type_, false , false) << " has been stored with another version of Main Dicom Tags list, you should POST to /" << Orthanc::GetResourceTypeText(resource.type_, true, false) << "/" << resource.id_ << "/reconstruct to update the list of tags saved in DB. Some MainDicomTags might be missing from this answer."; } } // MORE_TAGS: TODO: possibly merge missing requested tags from /tags + // log warning + // use resource.missingRequestedTags_ - SerializeExpandedResource(target, resource, format); + SerializeExpandedResource(target, resource, format, requestedTags); return true; }