comparison OrthancServer/Sources/OrthancInitialization.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 6eff25f70121
children f377d5643538
comparison
equal deleted inserted replaced
4933:312c6f4da888 4934:94a7b681b340
198 198
199 FromDcmtkBridge::RegisterDictionaryTag(tag, vr, name, minMultiplicity, maxMultiplicity, privateCreator); 199 FromDcmtkBridge::RegisterDictionaryTag(tag, vr, name, minMultiplicity, maxMultiplicity, privateCreator);
200 } 200 }
201 } 201 }
202 202
203 static void LoadMainDicomTags(const Json::Value& configuration)
204 {
205 static const char* const EXTRA_MAIN_DICOM_TAGS = "ExtraMainDicomTags";
206
207 if (configuration.type() != Json::objectValue ||
208 !configuration.isMember(EXTRA_MAIN_DICOM_TAGS) ||
209 configuration[EXTRA_MAIN_DICOM_TAGS].type() != Json::objectValue)
210 {
211 return;
212 }
213
214 Json::Value::Members levels(configuration[EXTRA_MAIN_DICOM_TAGS].getMemberNames());
215
216 for (Json::Value::ArrayIndex i = 0; i < levels.size(); i++)
217 {
218 ResourceType level;
219 if (levels[i] == "Patient")
220 {
221 level = ResourceType_Patient;
222 }
223 else if (levels[i] == "Study")
224 {
225 level = ResourceType_Study;
226 }
227 else if (levels[i] == "Series")
228 {
229 level = ResourceType_Series;
230 }
231 else if (levels[i] == "Instance")
232 {
233 level = ResourceType_Instance;
234 }
235 else
236 {
237 throw OrthancException(ErrorCode_BadFileFormat, "Unknown entry '" + levels[i] + "' in ExtraMainDicomTags.");
238 }
239
240 const Json::Value& content = configuration[EXTRA_MAIN_DICOM_TAGS][levels[i]];
241
242 if (content.type() != Json::arrayValue)
243 {
244 throw OrthancException(ErrorCode_BadFileFormat, "The definition of the '" + levels[i] + "' ExtraMainDicomTags entry is invalid (not an array).");
245 }
246
247 if (content.size() > 0)
248 {
249 LOG(INFO) << "Configured Extra Main Dicom Tags for " << levels[i] << ":";
250
251 for (Json::Value::ArrayIndex t = 0; t < content.size(); t++)
252 {
253 const std::string& tagName = content[t].asString();
254 DicomTag tag(FromDcmtkBridge::ParseTag(tagName));
255 DicomMap::AddMainDicomTag(tag, tagName, level);
256 LOG(INFO) << " - " << tagName;
257 }
258 }
259 }
260 }
203 261
204 static void ConfigurePkcs11(const Json::Value& config) 262 static void ConfigurePkcs11(const Json::Value& config)
205 { 263 {
206 static const char* const MODULE = "Module"; 264 static const char* const MODULE = "Module";
207 static const char* const VERBOSE = "Verbose"; 265 static const char* const VERBOSE = "Verbose";
297 RegisterUserContentType(lock.GetJson()); 355 RegisterUserContentType(lock.GetJson());
298 356
299 LoadExternalDictionaries(lock.GetJson()); // New in Orthanc 1.9.4 357 LoadExternalDictionaries(lock.GetJson()); // New in Orthanc 1.9.4
300 LoadCustomDictionary(lock.GetJson()); 358 LoadCustomDictionary(lock.GetJson());
301 359
360 LoadMainDicomTags(lock.GetJson()); // New in Orthanc 1.11.0
361
302 lock.GetConfiguration().RegisterFont(ServerResources::FONT_UBUNTU_MONO_BOLD_16); 362 lock.GetConfiguration().RegisterFont(ServerResources::FONT_UBUNTU_MONO_BOLD_16);
303 363
304 #if HAVE_MALLOPT == 1 364 #if HAVE_MALLOPT == 1
305 // New in Orthanc 1.8.2 365 // New in Orthanc 1.8.2
306 // https://book.orthanc-server.com/faq/scalability.html#controlling-memory-usage 366 // https://book.orthanc-server.com/faq/scalability.html#controlling-memory-usage