comparison 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
comparison
equal deleted inserted replaced
4933:312c6f4da888 4934:94a7b681b340
105 // list of studies, then remove the instances for each single 105 // list of studies, then remove the instances for each single
106 // study (check out OrthancRestApi::InvalidateTags for an 106 // study (check out OrthancRestApi::InvalidateTags for an
107 // example). Take this improvement into consideration for the 107 // example). Take this improvement into consideration for the
108 // next upgrade of the database schema. 108 // next upgrade of the database schema.
109 109
110 const char* plural = NULL; 110 const char* plural = Orthanc::GetResourceTypeText(level, true, true);
111
112 switch (level)
113 {
114 case ResourceType_Patient:
115 plural = "patients";
116 break;
117
118 case ResourceType_Study:
119 plural = "studies";
120 break;
121
122 case ResourceType_Series:
123 plural = "series";
124 break;
125
126 case ResourceType_Instance:
127 plural = "instances";
128 break;
129
130 default:
131 throw OrthancException(ErrorCode_InternalError);
132 }
133 111
134 LOG(WARNING) << "Upgrade: Reconstructing the main DICOM tags of all the " << plural << "..."; 112 LOG(WARNING) << "Upgrade: Reconstructing the main DICOM tags of all the " << plural << "...";
135 113
136 std::list<std::string> resources; 114 std::list<std::string> resources;
137 transaction.GetAllPublicIds(resources, level); 115 transaction.GetAllPublicIds(resources, level);
179 OrthancConfiguration::DefaultExtractDicomSummary(dicomSummary, dicom); 157 OrthancConfiguration::DefaultExtractDicomSummary(dicomSummary, dicom);
180 158
181 transaction.ClearMainDicomTags(resource); 159 transaction.ClearMainDicomTags(resource);
182 160
183 ResourcesContent tags(false /* prevent the setting of metadata */); 161 ResourcesContent tags(false /* prevent the setting of metadata */);
184 tags.AddResource(resource, level, dicomSummary); // MORE_TAGS: re-set the dicomMainTagsList metadata 162 tags.AddResource(resource, level, dicomSummary);
185 transaction.SetResourcesContent(tags); 163 transaction.SetResourcesContent(tags);
164
165 transaction.DeleteMetadata(resource, MetadataType_MainDicomTagsSignature);
166 transaction.SetMetadata(resource, MetadataType_MainDicomTagsSignature, DicomMap::GetMainDicomTagsSignature(level), 0);
186 } 167 }
187 catch (OrthancException&) 168 catch (OrthancException&)
188 { 169 {
189 LOG(ERROR) << "Cannot decode the DICOM file with UUID " << attachment.GetUuid() 170 LOG(ERROR) << "Cannot decode the DICOM file with UUID " << attachment.GetUuid()
190 << " associated with instance " << transaction.GetPublicId(instance); 171 << " associated with instance " << transaction.GetPublicId(instance);