# HG changeset patch # User Alain Mazy # Date 1647872382 -3600 # Node ID 3778a0433dd391e316dbd2950645c9c5adcaf808 # Parent f377d5643538348ab91562256a4489d3f51cab4f new field 'MainDicomTags' in the /system response diff -r f377d5643538 -r 3778a0433dd3 NEWS --- a/NEWS Thu Mar 17 17:03:59 2022 +0100 +++ b/NEWS Mon Mar 21 15:19:42 2022 +0100 @@ -32,7 +32,7 @@ - /studies, /studies/../series, /studies/../instances - /series, /series/../instances - /instances - +* new field "MainDicomTags" in the /system route response Documentation diff -r f377d5643538 -r 3778a0433dd3 OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp --- a/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp Thu Mar 17 17:03:59 2022 +0100 +++ b/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp Mon Mar 21 15:19:42 2022 +0100 @@ -1323,6 +1323,16 @@ Toolbox::JoinStrings(output, values, ";"); } + void FromDcmtkBridge::FormatListOfTags(Json::Value& output, const std::set& tags) + { + output = Json::arrayValue; + for (std::set::const_iterator it = tags.begin(); + it != tags.end(); it++) + { + output.append(it->Format()); + } + } + // parses a list like "0010,0010;PatientBirthDate;0020,0020" void FromDcmtkBridge::ParseListOfTags(std::set& result, const std::string& source) { diff -r f377d5643538 -r 3778a0433dd3 OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h --- a/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h Thu Mar 17 17:03:59 2022 +0100 +++ b/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h Mon Mar 21 15:19:42 2022 +0100 @@ -182,6 +182,8 @@ static void FormatListOfTags(std::string& output, const std::set& tags); + static void FormatListOfTags(Json::Value& output, const std::set& tags); + static bool HasTag(const DicomMap& fields, const std::string& tagName); diff -r f377d5643538 -r 3778a0433dd3 OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp --- a/OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp Thu Mar 17 17:03:59 2022 +0100 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp Mon Mar 21 15:19:42 2022 +0100 @@ -47,7 +47,24 @@ { call.GetOutput().Redirect("app/images/favicon.ico"); } - + + static void GetMainDicomTagsConfiguration(Json::Value& result) + { + Json::Value v; + + FromDcmtkBridge::FormatListOfTags(v, DicomMap::GetMainDicomTags(ResourceType_Patient)); + result["Patient"] = v; + + FromDcmtkBridge::FormatListOfTags(v, DicomMap::GetMainDicomTags(ResourceType_Study)); + result["Study"] = v; + + FromDcmtkBridge::FormatListOfTags(v, DicomMap::GetMainDicomTags(ResourceType_Series)); + result["Series"] = v; + + FromDcmtkBridge::FormatListOfTags(v, DicomMap::GetMainDicomTags(ResourceType_Instance)); + result["Instance"] = v; + } + static void GetSystemInformation(RestApiGetCall& call) { static const char* const API_VERSION = "ApiVersion"; @@ -62,6 +79,7 @@ static const char* const PLUGINS_ENABLED = "PluginsEnabled"; static const char* const STORAGE_AREA_PLUGIN = "StorageAreaPlugin"; static const char* const VERSION = "Version"; + static const char* const MAIN_DICOM_TAGS = "MainDicomTags"; if (call.IsDocumentation()) { @@ -88,6 +106,8 @@ "Whether Orthanc was built with support for plugins") .SetAnswerField(CHECK_REVISIONS, RestApiCallDocumentation::Type_Boolean, "Whether Orthanc handle revisions of metadata and attachments to deal with multiple writers (new in Orthanc 1.9.2)") + .SetAnswerField(MAIN_DICOM_TAGS, RestApiCallDocumentation::Type_JsonObject, + "The list of MainDicomTags saved in DB for each resource level (new in Orthanc 1.11.0)") .SetHttpGetSample("https://demo.orthanc-server.com/system", true); return; } @@ -132,6 +152,9 @@ result[PLUGINS_ENABLED] = false; #endif + result[MAIN_DICOM_TAGS] = Json::objectValue; + GetMainDicomTagsConfiguration(result[MAIN_DICOM_TAGS]); + call.GetOutput().AnswerJson(result); }