Mercurial > hg > orthanc
comparison OrthancServer/Sources/ServerContext.cpp @ 5222:3a61fd50f804 db-protobuf
starting refactoring ExpandedResource
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 03 Apr 2023 21:14:45 +0200 |
parents | d0f7c742d397 |
children | a7d95f951f8a |
comparison
equal
deleted
inserted
replaced
5221:d0f7c742d397 | 5222:3a61fd50f804 |
---|---|
1541 requestedTags.insert(DICOM_TAG_MODALITIES_IN_STUDY); | 1541 requestedTags.insert(DICOM_TAG_MODALITIES_IN_STUDY); |
1542 ExpandedResource resource; | 1542 ExpandedResource resource; |
1543 ComputeStudyTags(resource, *this, resources[i], requestedTags); | 1543 ComputeStudyTags(resource, *this, resources[i], requestedTags); |
1544 | 1544 |
1545 std::vector<std::string> modalities; | 1545 std::vector<std::string> modalities; |
1546 Toolbox::TokenizeString(modalities, resource.tags_.GetValue(DICOM_TAG_MODALITIES_IN_STUDY).GetContent(), '\\'); | 1546 Toolbox::TokenizeString(modalities, resource.GetMainDicomTags().GetValue(DICOM_TAG_MODALITIES_IN_STUDY).GetContent(), '\\'); |
1547 bool hasAtLeastOneModalityMatching = false; | 1547 bool hasAtLeastOneModalityMatching = false; |
1548 for (size_t m = 0; m < modalities.size(); m++) | 1548 for (size_t m = 0; m < modalities.size(); m++) |
1549 { | 1549 { |
1550 hasAtLeastOneModalityMatching |= dicomModalitiesConstraint->IsMatch(modalities[m]); | 1550 hasAtLeastOneModalityMatching |= dicomModalitiesConstraint->IsMatch(modalities[m]); |
1551 } | 1551 } |
1552 | 1552 |
1553 isMatch = isMatch && hasAtLeastOneModalityMatching; | 1553 isMatch = isMatch && hasAtLeastOneModalityMatching; |
1554 // copy the value of ModalitiesInStudy such that it can be reused to build the answer | 1554 // copy the value of ModalitiesInStudy such that it can be reused to build the answer |
1555 allMainDicomTagsFromDB.SetValue(DICOM_TAG_MODALITIES_IN_STUDY, resource.tags_.GetValue(DICOM_TAG_MODALITIES_IN_STUDY)); | 1555 allMainDicomTagsFromDB.SetValue(DICOM_TAG_MODALITIES_IN_STUDY, resource.GetMainDicomTags().GetValue(DICOM_TAG_MODALITIES_IN_STUDY)); |
1556 } | 1556 } |
1557 | 1557 |
1558 if (isMatch) | 1558 if (isMatch) |
1559 { | 1559 { |
1560 if (skipped < since) | 1560 if (skipped < since) |
1989 DicomToJsonFormat format, | 1989 DicomToJsonFormat format, |
1990 const std::set<DicomTag>& requestedTags) | 1990 const std::set<DicomTag>& requestedTags) |
1991 { | 1991 { |
1992 target = Json::objectValue; | 1992 target = Json::objectValue; |
1993 | 1993 |
1994 target["Type"] = GetResourceTypeText(resource.type_, false, true); | 1994 target["Type"] = GetResourceTypeText(resource.GetLevel(), false, true); |
1995 target["ID"] = resource.id_; | 1995 target["ID"] = resource.GetPublicId(); |
1996 | 1996 |
1997 switch (resource.type_) | 1997 switch (resource.GetLevel()) |
1998 { | 1998 { |
1999 case ResourceType_Patient: | 1999 case ResourceType_Patient: |
2000 break; | 2000 break; |
2001 | 2001 |
2002 case ResourceType_Study: | 2002 case ResourceType_Study: |
2013 | 2013 |
2014 default: | 2014 default: |
2015 throw OrthancException(ErrorCode_InternalError); | 2015 throw OrthancException(ErrorCode_InternalError); |
2016 } | 2016 } |
2017 | 2017 |
2018 switch (resource.type_) | 2018 switch (resource.GetLevel()) |
2019 { | 2019 { |
2020 case ResourceType_Patient: | 2020 case ResourceType_Patient: |
2021 case ResourceType_Study: | 2021 case ResourceType_Study: |
2022 case ResourceType_Series: | 2022 case ResourceType_Series: |
2023 { | 2023 { |
2027 it = resource.childrenIds_.begin(); it != resource.childrenIds_.end(); ++it) | 2027 it = resource.childrenIds_.begin(); it != resource.childrenIds_.end(); ++it) |
2028 { | 2028 { |
2029 c.append(*it); | 2029 c.append(*it); |
2030 } | 2030 } |
2031 | 2031 |
2032 if (resource.type_ == ResourceType_Patient) | 2032 if (resource.GetLevel() == ResourceType_Patient) |
2033 { | 2033 { |
2034 target["Studies"] = c; | 2034 target["Studies"] = c; |
2035 } | 2035 } |
2036 else if (resource.type_ == ResourceType_Study) | 2036 else if (resource.GetLevel() == ResourceType_Study) |
2037 { | 2037 { |
2038 target["Series"] = c; | 2038 target["Series"] = c; |
2039 } | 2039 } |
2040 else | 2040 else |
2041 { | 2041 { |
2049 | 2049 |
2050 default: | 2050 default: |
2051 throw OrthancException(ErrorCode_InternalError); | 2051 throw OrthancException(ErrorCode_InternalError); |
2052 } | 2052 } |
2053 | 2053 |
2054 switch (resource.type_) | 2054 switch (resource.GetLevel()) |
2055 { | 2055 { |
2056 case ResourceType_Patient: | 2056 case ResourceType_Patient: |
2057 case ResourceType_Study: | 2057 case ResourceType_Study: |
2058 break; | 2058 break; |
2059 | 2059 |
2098 if (!resource.modifiedFrom_.empty()) | 2098 if (!resource.modifiedFrom_.empty()) |
2099 { | 2099 { |
2100 target["ModifiedFrom"] = resource.modifiedFrom_; | 2100 target["ModifiedFrom"] = resource.modifiedFrom_; |
2101 } | 2101 } |
2102 | 2102 |
2103 if (resource.type_ == ResourceType_Patient || | 2103 if (resource.GetLevel() == ResourceType_Patient || |
2104 resource.type_ == ResourceType_Study || | 2104 resource.GetLevel() == ResourceType_Study || |
2105 resource.type_ == ResourceType_Series) | 2105 resource.GetLevel() == ResourceType_Series) |
2106 { | 2106 { |
2107 target["IsStable"] = resource.isStable_; | 2107 target["IsStable"] = resource.isStable_; |
2108 | 2108 |
2109 if (!resource.lastUpdate_.empty()) | 2109 if (!resource.lastUpdate_.empty()) |
2110 { | 2110 { |
2116 | 2116 |
2117 static const char* const MAIN_DICOM_TAGS = "MainDicomTags"; | 2117 static const char* const MAIN_DICOM_TAGS = "MainDicomTags"; |
2118 static const char* const PATIENT_MAIN_DICOM_TAGS = "PatientMainDicomTags"; | 2118 static const char* const PATIENT_MAIN_DICOM_TAGS = "PatientMainDicomTags"; |
2119 | 2119 |
2120 DicomMap mainDicomTags; | 2120 DicomMap mainDicomTags; |
2121 resource.tags_.ExtractResourceInformation(mainDicomTags, resource.type_); | 2121 resource.GetMainDicomTags().ExtractResourceInformation(mainDicomTags, resource.GetLevel()); |
2122 | 2122 |
2123 target[MAIN_DICOM_TAGS] = Json::objectValue; | 2123 target[MAIN_DICOM_TAGS] = Json::objectValue; |
2124 FromDcmtkBridge::ToJson(target[MAIN_DICOM_TAGS], mainDicomTags, format); | 2124 FromDcmtkBridge::ToJson(target[MAIN_DICOM_TAGS], mainDicomTags, format); |
2125 | 2125 |
2126 if (resource.type_ == ResourceType_Study) | 2126 if (resource.GetLevel() == ResourceType_Study) |
2127 { | 2127 { |
2128 DicomMap patientMainDicomTags; | 2128 DicomMap patientMainDicomTags; |
2129 resource.tags_.ExtractPatientInformation(patientMainDicomTags); | 2129 resource.GetMainDicomTags().ExtractPatientInformation(patientMainDicomTags); |
2130 | 2130 |
2131 target[PATIENT_MAIN_DICOM_TAGS] = Json::objectValue; | 2131 target[PATIENT_MAIN_DICOM_TAGS] = Json::objectValue; |
2132 FromDcmtkBridge::ToJson(target[PATIENT_MAIN_DICOM_TAGS], patientMainDicomTags, format); | 2132 FromDcmtkBridge::ToJson(target[PATIENT_MAIN_DICOM_TAGS], patientMainDicomTags, format); |
2133 } | 2133 } |
2134 | 2134 |
2135 if (requestedTags.size() > 0) | 2135 if (requestedTags.size() > 0) |
2136 { | 2136 { |
2137 static const char* const REQUESTED_TAGS = "RequestedTags"; | 2137 static const char* const REQUESTED_TAGS = "RequestedTags"; |
2138 | 2138 |
2139 DicomMap tags; | 2139 DicomMap tags; |
2140 resource.tags_.ExtractTags(tags, requestedTags); | 2140 resource.GetMainDicomTags().ExtractTags(tags, requestedTags); |
2141 | 2141 |
2142 target[REQUESTED_TAGS] = Json::objectValue; | 2142 target[REQUESTED_TAGS] = Json::objectValue; |
2143 FromDcmtkBridge::ToJson(target[REQUESTED_TAGS], tags, format); | 2143 FromDcmtkBridge::ToJson(target[REQUESTED_TAGS], tags, format); |
2144 | 2144 |
2145 } | 2145 } |
2162 const std::string& instancePublicId, | 2162 const std::string& instancePublicId, |
2163 const std::set<DicomTag>& requestedTags) | 2163 const std::set<DicomTag>& requestedTags) |
2164 { | 2164 { |
2165 if (requestedTags.count(DICOM_TAG_INSTANCE_AVAILABILITY) > 0) | 2165 if (requestedTags.count(DICOM_TAG_INSTANCE_AVAILABILITY) > 0) |
2166 { | 2166 { |
2167 resource.tags_.SetValue(DICOM_TAG_INSTANCE_AVAILABILITY, "ONLINE", false); | 2167 resource.GetMainDicomTags().SetValue(DICOM_TAG_INSTANCE_AVAILABILITY, "ONLINE", false); |
2168 resource.missingRequestedTags_.erase(DICOM_TAG_INSTANCE_AVAILABILITY); | 2168 resource.missingRequestedTags_.erase(DICOM_TAG_INSTANCE_AVAILABILITY); |
2169 } | 2169 } |
2170 } | 2170 } |
2171 | 2171 |
2172 | 2172 |
2180 ServerIndex& index = context.GetIndex(); | 2180 ServerIndex& index = context.GetIndex(); |
2181 std::list<std::string> instances; | 2181 std::list<std::string> instances; |
2182 | 2182 |
2183 index.GetChildren(instances, seriesPublicId); | 2183 index.GetChildren(instances, seriesPublicId); |
2184 | 2184 |
2185 resource.tags_.SetValue(DICOM_TAG_NUMBER_OF_SERIES_RELATED_INSTANCES, | 2185 resource.GetMainDicomTags().SetValue(DICOM_TAG_NUMBER_OF_SERIES_RELATED_INSTANCES, |
2186 boost::lexical_cast<std::string>(instances.size()), false); | 2186 boost::lexical_cast<std::string>(instances.size()), false); |
2187 resource.missingRequestedTags_.erase(DICOM_TAG_NUMBER_OF_SERIES_RELATED_INSTANCES); | 2187 resource.missingRequestedTags_.erase(DICOM_TAG_NUMBER_OF_SERIES_RELATED_INSTANCES); |
2188 } | 2188 } |
2189 } | 2189 } |
2190 | 2190 |
2225 } | 2225 } |
2226 | 2226 |
2227 std::string modalities; | 2227 std::string modalities; |
2228 Toolbox::JoinStrings(modalities, values, "\\"); | 2228 Toolbox::JoinStrings(modalities, values, "\\"); |
2229 | 2229 |
2230 resource.tags_.SetValue(DICOM_TAG_MODALITIES_IN_STUDY, modalities, false); | 2230 resource.GetMainDicomTags().SetValue(DICOM_TAG_MODALITIES_IN_STUDY, modalities, false); |
2231 resource.missingRequestedTags_.erase(DICOM_TAG_MODALITIES_IN_STUDY); | 2231 resource.missingRequestedTags_.erase(DICOM_TAG_MODALITIES_IN_STUDY); |
2232 } | 2232 } |
2233 | 2233 |
2234 if (hasNbRelatedSeries) | 2234 if (hasNbRelatedSeries) |
2235 { | 2235 { |
2236 resource.tags_.SetValue(DICOM_TAG_NUMBER_OF_STUDY_RELATED_SERIES, | 2236 resource.GetMainDicomTags().SetValue(DICOM_TAG_NUMBER_OF_STUDY_RELATED_SERIES, |
2237 boost::lexical_cast<std::string>(series.size()), false); | 2237 boost::lexical_cast<std::string>(series.size()), false); |
2238 resource.missingRequestedTags_.erase(DICOM_TAG_NUMBER_OF_STUDY_RELATED_SERIES); | 2238 resource.missingRequestedTags_.erase(DICOM_TAG_NUMBER_OF_STUDY_RELATED_SERIES); |
2239 } | 2239 } |
2240 | 2240 |
2241 if (hasNbRelatedInstances || hasSopClassesInStudy) | 2241 if (hasNbRelatedInstances || hasSopClassesInStudy) |
2249 instances.splice(instances.end(), seriesInstancesIds); | 2249 instances.splice(instances.end(), seriesInstancesIds); |
2250 } | 2250 } |
2251 | 2251 |
2252 if (hasNbRelatedInstances) | 2252 if (hasNbRelatedInstances) |
2253 { | 2253 { |
2254 resource.tags_.SetValue(DICOM_TAG_NUMBER_OF_STUDY_RELATED_INSTANCES, | 2254 resource.GetMainDicomTags().SetValue(DICOM_TAG_NUMBER_OF_STUDY_RELATED_INSTANCES, |
2255 boost::lexical_cast<std::string>(instances.size()), false); | 2255 boost::lexical_cast<std::string>(instances.size()), false); |
2256 resource.missingRequestedTags_.erase(DICOM_TAG_NUMBER_OF_STUDY_RELATED_INSTANCES); | 2256 resource.missingRequestedTags_.erase(DICOM_TAG_NUMBER_OF_STUDY_RELATED_INSTANCES); |
2257 } | 2257 } |
2258 | 2258 |
2259 if (hasSopClassesInStudy) | 2259 if (hasSopClassesInStudy) |
2273 | 2273 |
2274 if (values.size() > 0) | 2274 if (values.size() > 0) |
2275 { | 2275 { |
2276 std::string sopClassUids; | 2276 std::string sopClassUids; |
2277 Toolbox::JoinStrings(sopClassUids, values, "\\"); | 2277 Toolbox::JoinStrings(sopClassUids, values, "\\"); |
2278 resource.tags_.SetValue(DICOM_TAG_SOP_CLASSES_IN_STUDY, sopClassUids, false); | 2278 resource.GetMainDicomTags().SetValue(DICOM_TAG_SOP_CLASSES_IN_STUDY, sopClassUids, false); |
2279 } | 2279 } |
2280 | 2280 |
2281 resource.missingRequestedTags_.erase(DICOM_TAG_SOP_CLASSES_IN_STUDY); | 2281 resource.missingRequestedTags_.erase(DICOM_TAG_SOP_CLASSES_IN_STUDY); |
2282 } | 2282 } |
2283 } | 2283 } |
2300 | 2300 |
2301 index.GetChildren(studies, patientPublicId); | 2301 index.GetChildren(studies, patientPublicId); |
2302 | 2302 |
2303 if (hasNbRelatedStudies) | 2303 if (hasNbRelatedStudies) |
2304 { | 2304 { |
2305 resource.tags_.SetValue(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_STUDIES, | 2305 resource.GetMainDicomTags().SetValue(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_STUDIES, |
2306 boost::lexical_cast<std::string>(studies.size()), false); | 2306 boost::lexical_cast<std::string>(studies.size()), false); |
2307 resource.missingRequestedTags_.erase(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_STUDIES); | 2307 resource.missingRequestedTags_.erase(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_STUDIES); |
2308 } | 2308 } |
2309 | 2309 |
2310 if (hasNbRelatedSeries || hasNbRelatedInstances) | 2310 if (hasNbRelatedSeries || hasNbRelatedInstances) |
2317 series.splice(series.end(), thisSeriesIds); | 2317 series.splice(series.end(), thisSeriesIds); |
2318 } | 2318 } |
2319 | 2319 |
2320 if (hasNbRelatedSeries) | 2320 if (hasNbRelatedSeries) |
2321 { | 2321 { |
2322 resource.tags_.SetValue(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_SERIES, | 2322 resource.GetMainDicomTags().SetValue(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_SERIES, |
2323 boost::lexical_cast<std::string>(series.size()), false); | 2323 boost::lexical_cast<std::string>(series.size()), false); |
2324 resource.missingRequestedTags_.erase(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_SERIES); | 2324 resource.missingRequestedTags_.erase(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_SERIES); |
2325 } | 2325 } |
2326 } | 2326 } |
2327 | 2327 |
2333 std::list<std::string> thisInstancesIds; | 2333 std::list<std::string> thisInstancesIds; |
2334 index.GetChildren(thisInstancesIds, *it); | 2334 index.GetChildren(thisInstancesIds, *it); |
2335 instances.splice(instances.end(), thisInstancesIds); | 2335 instances.splice(instances.end(), thisInstancesIds); |
2336 } | 2336 } |
2337 | 2337 |
2338 resource.tags_.SetValue(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES, | 2338 resource.GetMainDicomTags().SetValue(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES, |
2339 boost::lexical_cast<std::string>(instances.size()), false); | 2339 boost::lexical_cast<std::string>(instances.size()), false); |
2340 resource.missingRequestedTags_.erase(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES); | 2340 resource.missingRequestedTags_.erase(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES); |
2341 } | 2341 } |
2342 } | 2342 } |
2343 | 2343 |
2397 const std::set<DicomTag>& requestedTags, | 2397 const std::set<DicomTag>& requestedTags, |
2398 bool allowStorageAccess) | 2398 bool allowStorageAccess) |
2399 { | 2399 { |
2400 ExpandedResource resource; | 2400 ExpandedResource resource; |
2401 | 2401 |
2402 if (ExpandResource(resource, publicId, mainDicomTags, instanceId, dicomAsJson, level, requestedTags, ExpandResourceDbFlags_Default, allowStorageAccess)) | 2402 if (ExpandResource(resource, publicId, mainDicomTags, instanceId, dicomAsJson, level, requestedTags, ExpandResourceFlags_Default, allowStorageAccess)) |
2403 { | 2403 { |
2404 SerializeExpandedResource(target, resource, format, requestedTags); | 2404 SerializeExpandedResource(target, resource, format, requestedTags); |
2405 return true; | 2405 return true; |
2406 } | 2406 } |
2407 | 2407 |
2413 const DicomMap& mainDicomTags, // optional: the main dicom tags for the resource (if already available) | 2413 const DicomMap& mainDicomTags, // optional: the main dicom tags for the resource (if already available) |
2414 const std::string& instanceId, // optional: the id of an instance for the resource (if already available) | 2414 const std::string& instanceId, // optional: the id of an instance for the resource (if already available) |
2415 const Json::Value* dicomAsJson, // optional: the dicom-as-json for the resource (if already available) | 2415 const Json::Value* dicomAsJson, // optional: the dicom-as-json for the resource (if already available) |
2416 ResourceType level, | 2416 ResourceType level, |
2417 const std::set<DicomTag>& requestedTags, | 2417 const std::set<DicomTag>& requestedTags, |
2418 ExpandResourceDbFlags expandFlags, | 2418 ExpandResourceFlags expandFlags, |
2419 bool allowStorageAccess) | 2419 bool allowStorageAccess) |
2420 { | 2420 { |
2421 // first try to get the tags from what is already available | 2421 // first try to get the tags from what is already available |
2422 | 2422 |
2423 if ((expandFlags & ExpandResourceDbFlags_IncludeMainDicomTags) | 2423 if ((expandFlags & ExpandResourceFlags_IncludeMainDicomTags) && |
2424 && (mainDicomTags.GetSize() > 0) | 2424 mainDicomTags.GetSize() > 0 && |
2425 && (dicomAsJson != NULL)) | 2425 dicomAsJson != NULL) |
2426 { | 2426 { |
2427 | 2427 |
2428 resource.tags_.Merge(mainDicomTags); | 2428 resource.GetMainDicomTags().Merge(mainDicomTags); |
2429 | 2429 |
2430 if (dicomAsJson->isObject()) | 2430 if (dicomAsJson->isObject()) |
2431 { | 2431 { |
2432 resource.tags_.FromDicomAsJson(*dicomAsJson); | 2432 resource.GetMainDicomTags().FromDicomAsJson(*dicomAsJson); |
2433 } | 2433 } |
2434 | 2434 |
2435 std::set<DicomTag> retrievedTags; | 2435 std::set<DicomTag> retrievedTags; |
2436 std::set<DicomTag> missingTags; | 2436 std::set<DicomTag> missingTags; |
2437 resource.tags_.GetTags(retrievedTags); | 2437 resource.GetMainDicomTags().GetTags(retrievedTags); |
2438 | 2438 |
2439 Toolbox::GetMissingsFromSet(missingTags, requestedTags, retrievedTags); | 2439 Toolbox::GetMissingsFromSet(missingTags, requestedTags, retrievedTags); |
2440 | 2440 |
2441 // if all possible tags have been read, no need to get them from DB anymore | 2441 // if all possible tags have been read, no need to get them from DB anymore |
2442 if (missingTags.size() == 0 || DicomMap::HasOnlyComputedTags(missingTags)) | 2442 if (missingTags.size() == 0 || DicomMap::HasOnlyComputedTags(missingTags)) |
2443 { | 2443 { |
2444 expandFlags = static_cast<ExpandResourceDbFlags>(expandFlags & ~ExpandResourceDbFlags_IncludeMainDicomTags); | 2444 expandFlags = static_cast<ExpandResourceFlags>(expandFlags & ~ExpandResourceFlags_IncludeMainDicomTags); |
2445 } | 2445 } |
2446 | 2446 |
2447 if (missingTags.size() == 0 && expandFlags == ExpandResourceDbFlags_None) // we have already retrieved anything we need | 2447 if (missingTags.size() == 0 && expandFlags == ExpandResourceFlags_None) // we have already retrieved anything we need |
2448 { | 2448 { |
2449 return true; | 2449 return true; |
2450 } | 2450 } |
2451 } | 2451 } |
2452 | 2452 |
2453 if (expandFlags != ExpandResourceDbFlags_None | 2453 if (expandFlags != ExpandResourceFlags_None && |
2454 && GetIndex().ExpandResource(resource, publicId, level, requestedTags, static_cast<ExpandResourceDbFlags>(expandFlags | ExpandResourceDbFlags_IncludeMetadata))) // we always need the metadata to get the mainDicomTagsSignature | 2454 GetIndex().ExpandResource(resource, publicId, level, requestedTags, |
2455 static_cast<ExpandResourceFlags>(expandFlags | ExpandResourceFlags_IncludeMetadata))) // we always need the metadata to get the mainDicomTagsSignature | |
2455 { | 2456 { |
2456 // check the main dicom tags list has not changed since the resource was stored | 2457 // check the main dicom tags list has not changed since the resource was stored |
2457 if (resource.mainDicomTagsSignature_ != DicomMap::GetMainDicomTagsSignature(resource.type_)) | 2458 if (resource.mainDicomTagsSignature_ != DicomMap::GetMainDicomTagsSignature(resource.GetLevel())) |
2458 { | 2459 { |
2459 OrthancConfiguration::ReaderLock lock; | 2460 OrthancConfiguration::ReaderLock lock; |
2460 if (lock.GetConfiguration().IsWarningEnabled(Warnings_002_InconsistentDicomTagsInDb)) | 2461 if (lock.GetConfiguration().IsWarningEnabled(Warnings_002_InconsistentDicomTagsInDb)) |
2461 { | 2462 { |
2462 LOG(WARNING) << "W002: " << 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."; | 2463 LOG(WARNING) << "W002: " << Orthanc::GetResourceTypeText(resource.GetLevel(), false , false) |
2464 << " has been stored with another version of Main Dicom Tags list, you should POST to /" | |
2465 << Orthanc::GetResourceTypeText(resource.GetLevel(), true, false) | |
2466 << "/" << resource.GetPublicId() | |
2467 << "/reconstruct to update the list of tags saved in DB. Some MainDicomTags might be missing from this answer."; | |
2463 } | 2468 } |
2464 } | 2469 } |
2465 | 2470 |
2466 // possibly merge missing requested tags from dicom-as-json | 2471 // possibly merge missing requested tags from dicom-as-json |
2467 if (allowStorageAccess | 2472 if (allowStorageAccess && |
2468 && !resource.missingRequestedTags_.empty() && !DicomMap::HasOnlyComputedTags(resource.missingRequestedTags_)) | 2473 !resource.missingRequestedTags_.empty() && |
2474 !DicomMap::HasOnlyComputedTags(resource.missingRequestedTags_)) | |
2469 { | 2475 { |
2470 OrthancConfiguration::ReaderLock lock; | 2476 OrthancConfiguration::ReaderLock lock; |
2471 if (lock.GetConfiguration().IsWarningEnabled(Warnings_001_TagsBeingReadFromStorage)) | 2477 if (lock.GetConfiguration().IsWarningEnabled(Warnings_001_TagsBeingReadFromStorage)) |
2472 { | 2478 { |
2473 std::set<DicomTag> missingTags; | 2479 std::set<DicomTag> missingTags; |
2481 } | 2487 } |
2482 | 2488 |
2483 std::string missings; | 2489 std::string missings; |
2484 FromDcmtkBridge::FormatListOfTags(missings, missingTags); | 2490 FromDcmtkBridge::FormatListOfTags(missings, missingTags); |
2485 | 2491 |
2486 LOG(WARNING) << "W001: Accessing Dicom tags from storage when accessing " << Orthanc::GetResourceTypeText(resource.type_, false , false) << " : " << missings; | 2492 LOG(WARNING) << "W001: Accessing Dicom tags from storage when accessing " |
2493 << Orthanc::GetResourceTypeText(resource.GetLevel(), false, false) | |
2494 << " : " << missings; | |
2487 } | 2495 } |
2488 | 2496 |
2489 | 2497 |
2490 std::string instanceId_ = instanceId; | 2498 std::string instanceId_ = instanceId; |
2491 DicomMap tagsFromJson; | 2499 DicomMap tagsFromJson; |
2517 else | 2525 else |
2518 { | 2526 { |
2519 tagsFromJson.FromDicomAsJson(*dicomAsJson, false /* append */, true /* parseSequences*/); | 2527 tagsFromJson.FromDicomAsJson(*dicomAsJson, false /* append */, true /* parseSequences*/); |
2520 } | 2528 } |
2521 | 2529 |
2522 resource.tags_.Merge(tagsFromJson); | 2530 resource.GetMainDicomTags().Merge(tagsFromJson); |
2523 } | 2531 } |
2524 | 2532 |
2525 // compute the requested tags | 2533 // compute the requested tags |
2526 ComputeTags(resource, *this, publicId, level, requestedTags); | 2534 ComputeTags(resource, *this, publicId, level, requestedTags); |
2527 } | 2535 } |