diff OrthancServer/Sources/ServerToolbox.cpp @ 4934:94a7b681b340 more-tags

added configuration for extra main dicom tags + save signature in metadata + show warning if inconsistent main dicom tags
author Alain Mazy <am@osimis.io>
date Thu, 10 Mar 2022 09:03:24 +0100
parents b7ce2bb6b881
children 8fba26292a9f
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerToolbox.cpp	Wed Mar 09 12:16:45 2022 +0100
+++ b/OrthancServer/Sources/ServerToolbox.cpp	Thu Mar 10 09:03:24 2022 +0100
@@ -107,29 +107,7 @@
       // example). Take this improvement into consideration for the
       // next upgrade of the database schema.
 
-      const char* plural = NULL;
-
-      switch (level)
-      {
-        case ResourceType_Patient:
-          plural = "patients";
-          break;
-
-        case ResourceType_Study:
-          plural = "studies";
-          break;
-
-        case ResourceType_Series:
-          plural = "series";
-          break;
-
-        case ResourceType_Instance:
-          plural = "instances";
-          break;
-
-        default:
-          throw OrthancException(ErrorCode_InternalError);
-      }
+      const char* plural = Orthanc::GetResourceTypeText(level, true, true);
 
       LOG(WARNING) << "Upgrade: Reconstructing the main DICOM tags of all the " << plural << "...";
 
@@ -181,8 +159,11 @@
           transaction.ClearMainDicomTags(resource);
 
           ResourcesContent tags(false /* prevent the setting of metadata */);
-          tags.AddResource(resource, level, dicomSummary);  // MORE_TAGS: re-set the dicomMainTagsList metadata
+          tags.AddResource(resource, level, dicomSummary);
           transaction.SetResourcesContent(tags);
+
+          transaction.DeleteMetadata(resource, MetadataType_MainDicomTagsSignature);
+          transaction.SetMetadata(resource, MetadataType_MainDicomTagsSignature, DicomMap::GetMainDicomTagsSignature(level), 0);
         }
         catch (OrthancException&)
         {