Mercurial > hg > orthanc
changeset 5212:19e916dfc767 db-protobuf
integration mainline->db-protobuf
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 03 Apr 2023 10:30:15 +0200 |
parents | 27e6ec2811e3 (current diff) 1fa3bfa86f8e (diff) |
children | 055428d92772 |
files | OrthancFramework/Resources/CMake/OrthancFrameworkParameters.cmake |
diffstat | 7 files changed, 52 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Mon Apr 03 10:29:45 2023 +0200 +++ b/NEWS Mon Apr 03 10:30:15 2023 +0200 @@ -1,6 +1,12 @@ Pending changes in the mainline =============================== +REST API +-------- + +* API version upgraded to 20 +* /system: added UserMetadata + Maintenance -----------
--- a/OrthancFramework/Resources/CMake/OrthancFrameworkParameters.cmake Mon Apr 03 10:29:45 2023 +0200 +++ b/OrthancFramework/Resources/CMake/OrthancFrameworkParameters.cmake Mon Apr 03 10:30:15 2023 +0200 @@ -38,7 +38,7 @@ # Version of the Orthanc API, can be retrieved from "/system" URI in # order to check whether new URI endpoints are available even if using # the mainline version of Orthanc -set(ORTHANC_API_VERSION "19") +set(ORTHANC_API_VERSION "20") #####################################################################
--- a/OrthancFramework/Sources/EnumerationDictionary.h Mon Apr 03 10:29:45 2023 +0200 +++ b/OrthancFramework/Sources/EnumerationDictionary.h Mon Apr 03 10:30:15 2023 +0200 @@ -105,5 +105,10 @@ return found->second; } } + + const std::map<std::string, Enumeration>& GetAllEntries() const + { + return stringToEnumeration_; + } }; }
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp Mon Apr 03 10:29:45 2023 +0200 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp Mon Apr 03 10:30:15 2023 +0200 @@ -50,14 +50,23 @@ static void GetMainDicomTagsConfiguration(Json::Value& result) { - Json::Value v; - result["Patient"] = DicomMap::GetMainDicomTagsSignature(ResourceType_Patient); result["Study"] = DicomMap::GetMainDicomTagsSignature(ResourceType_Study); result["Series"] = DicomMap::GetMainDicomTagsSignature(ResourceType_Series); result["Instance"] = DicomMap::GetMainDicomTagsSignature(ResourceType_Instance); } + static void GetUserMetadataConfiguration(Json::Value& result) + { + std::map<std::string, int> userMetadata; + Orthanc::GetRegisteredUserMetadata(userMetadata); + + for (std::map<std::string, int>::const_iterator it = userMetadata.begin(); it != userMetadata.end(); ++it) + { + result[it->first] = it->second; + } + } + static void GetSystemInformation(RestApiGetCall& call) { static const char* const API_VERSION = "ApiVersion"; @@ -79,6 +88,7 @@ static const char* const INGEST_TRANSCODING = "IngestTranscoding"; static const char* const MAXIMUM_STORAGE_SIZE = "MaximumStorageSize"; static const char* const MAXIMUM_STORAGE_MODE = "MaximumStorageMode"; + static const char* const USER_METADATA = "UserMetadata"; if (call.IsDocumentation()) { @@ -119,6 +129,8 @@ "The configured MaximumStorageSize in MB (new in Orthanc 1.11.3)") .SetAnswerField(MAXIMUM_STORAGE_MODE, RestApiCallDocumentation::Type_String, "The configured MaximumStorageMode (new in Orthanc 1.11.3)") + .SetAnswerField(USER_METADATA, RestApiCallDocumentation::Type_JsonObject, + "The configured UserMetadata (new in Orthanc 1.12.0)") .SetHttpGetSample("https://demo.orthanc-server.com/system", true); return; } @@ -172,6 +184,9 @@ result[MAIN_DICOM_TAGS] = Json::objectValue; GetMainDicomTagsConfiguration(result[MAIN_DICOM_TAGS]); + result[USER_METADATA] = Json::objectValue; + GetUserMetadataConfiguration(result[USER_METADATA]); + call.GetOutput().AnswerJson(result); }
--- a/OrthancServer/Sources/ServerEnumerations.cpp Mon Apr 03 10:29:45 2023 +0200 +++ b/OrthancServer/Sources/ServerEnumerations.cpp Mon Apr 03 10:30:15 2023 +0200 @@ -112,6 +112,23 @@ return dictMetadataType_.Translate(str); } + void GetRegisteredUserMetadata(std::map<std::string, int>& allEntries) + { + boost::mutex::scoped_lock lock(enumerationsMutex_); + + allEntries.clear(); + + std::map<std::string, MetadataType> allEntriesTyped = dictMetadataType_.GetAllEntries(); + + for (std::map<std::string, MetadataType>::const_iterator it = allEntriesTyped.begin(); it != allEntriesTyped.end(); ++it) + { + if (it->second >= MetadataType_StartUser) + { + allEntries[it->first] = it->second; + } + } + } + void RegisterUserContentType(int contentType, const std::string& name, const std::string& mime)
--- a/OrthancServer/Sources/ServerEnumerations.h Mon Apr 03 10:29:45 2023 +0200 +++ b/OrthancServer/Sources/ServerEnumerations.h Mon Apr 03 10:30:15 2023 +0200 @@ -216,6 +216,8 @@ std::string EnumerationToString(MetadataType type); + void GetRegisteredUserMetadata(std::map<std::string, int>& allEntries); + void RegisterUserContentType(int contentType, const std::string& name, const std::string& mime);
--- a/TODO Mon Apr 03 10:29:45 2023 +0200 +++ b/TODO Mon Apr 03 10:30:15 2023 +0200 @@ -115,6 +115,10 @@ https://groups.google.com/g/orthanc-users/c/rDDusFG5Lco/m/TzTUjWXLAQAJ * allow filtering/ordering on the /jobs route: https://groups.google.com/g/orthanc-users/c/hsZ1jng5rIg/m/8xZL2C1VBgAJ +* Also implement a GET variant of /tools/create-archive + sibling routes + in which resources & transcode options are provided as get arguments. + https://groups.google.com/g/orthanc-users/c/PmaRZ609ztA/m/JdwXvIBKAQAJ + --------- Long-term