Mercurial > hg > orthanc
changeset 3808:7f083dfae62b
new REST route: /modalities/{id}/store-straight
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 03 Apr 2020 14:06:13 +0200 |
parents | 2f28c7eb2776 |
children | 2bf30ef727e3 |
files | Core/DicomNetworking/DicomUserConnection.cpp Core/DicomNetworking/DicomUserConnection.h NEWS OrthancServer/OrthancRestApi/OrthancRestModalities.cpp Resources/CMake/OrthancFrameworkParameters.cmake |
diffstat | 5 files changed, 39 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/Core/DicomNetworking/DicomUserConnection.cpp Thu Apr 02 18:08:08 2020 +0200 +++ b/Core/DicomNetworking/DicomUserConnection.cpp Fri Apr 03 14:06:13 2020 +0200 @@ -1211,7 +1211,7 @@ void DicomUserConnection::Store(std::string& sopClassUid /* out */, std::string& sopInstanceUid /* out */, - const char* buffer, + const void* buffer, size_t size, const std::string& moveOriginatorAET, uint16_t moveOriginatorID)
--- a/Core/DicomNetworking/DicomUserConnection.h Thu Apr 02 18:08:08 2020 +0200 +++ b/Core/DicomNetworking/DicomUserConnection.h Fri Apr 03 14:06:13 2020 +0200 @@ -160,14 +160,14 @@ void Store(std::string& sopClassUid /* out */, std::string& sopInstanceUid /* out */, - const char* buffer, + const void* buffer, size_t size, const std::string& moveOriginatorAET, uint16_t moveOriginatorID); void Store(std::string& sopClassUid /* out */, std::string& sopInstanceUid /* out */, - const char* buffer, + const void* buffer, size_t size) { Store(sopClassUid, sopInstanceUid, buffer, size, "", 0); // Not a C-Move
--- a/NEWS Thu Apr 02 18:08:08 2020 +0200 +++ b/NEWS Fri Apr 03 14:06:13 2020 +0200 @@ -2,6 +2,15 @@ =============================== +REST API +-------- + +* API version has been upgraded to 6 +* Added: + - "/modalities/{id}/store-straight": Synchronously send the DICOM instance in POST + body to another modality (alternative to command-line tools such as "storescu") + + Maintenance -----------
--- a/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp Thu Apr 02 18:08:08 2020 +0200 +++ b/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp Fri Apr 03 14:06:13 2020 +0200 @@ -55,6 +55,8 @@ static const char* const KEY_QUERY = "Query"; static const char* const KEY_NORMALIZE = "Normalize"; static const char* const KEY_RESOURCES = "Resources"; + static const char* const SOP_CLASS_UID = "SOPClassUID"; + static const char* const SOP_INSTANCE_UID = "SOPInstanceUID"; static RemoteModalityParameters MyGetModalityUsingSymbolicName(const std::string& name) @@ -975,6 +977,29 @@ } + static void DicomStoreStraight(RestApiPostCall& call) + { + ServerContext& context = OrthancRestApi::GetContext(call); + + const std::string& localAet = context.GetDefaultLocalApplicationEntityTitle(); + RemoteModalityParameters remote = + MyGetModalityUsingSymbolicName(call.GetUriComponent("id", "")); + + DicomUserConnection connection(localAet, remote); + connection.Open(); + + std::string sopClassUid, sopInstanceUid; + connection.Store(sopClassUid, sopInstanceUid, + call.GetBodyData(), call.GetBodySize()); + + Json::Value answer = Json::objectValue; + answer[SOP_CLASS_UID] = sopClassUid; + answer[SOP_INSTANCE_UID] = sopInstanceUid; + + call.GetOutput().AnswerJson(answer); + } + + /*************************************************************************** * DICOM C-Move SCU ***************************************************************************/ @@ -1312,8 +1337,6 @@ { static const char* const ORTHANC_RESOURCES = "Resources"; static const char* const DICOM_INSTANCES = "DicomInstances"; - static const char* const SOP_CLASS_UID = "SOPClassUID"; - static const char* const SOP_INSTANCE_UID = "SOPInstanceUID"; ServerContext& context = OrthancRestApi::GetContext(call); @@ -1564,6 +1587,7 @@ Register("/modalities/{id}/find-instance", DicomFindInstance); Register("/modalities/{id}/find", DicomFind); Register("/modalities/{id}/store", DicomStore); + Register("/modalities/{id}/store-straight", DicomStoreStraight); // New in 1.6.1 Register("/modalities/{id}/move", DicomMove); // For Query/Retrieve
--- a/Resources/CMake/OrthancFrameworkParameters.cmake Thu Apr 02 18:08:08 2020 +0200 +++ b/Resources/CMake/OrthancFrameworkParameters.cmake Fri Apr 03 14:06:13 2020 +0200 @@ -17,7 +17,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 "5") +set(ORTHANC_API_VERSION "6") #####################################################################