# HG changeset patch # User Sebastien Jodogne # Date 1585915573 -7200 # Node ID 7f083dfae62b7031fd964681e7ab01e576e49d54 # Parent 2f28c7eb27768afdd4f064c975f623bc376334a5 new REST route: /modalities/{id}/store-straight diff -r 2f28c7eb2776 -r 7f083dfae62b Core/DicomNetworking/DicomUserConnection.cpp --- 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) diff -r 2f28c7eb2776 -r 7f083dfae62b Core/DicomNetworking/DicomUserConnection.h --- 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 diff -r 2f28c7eb2776 -r 7f083dfae62b NEWS --- 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 ----------- diff -r 2f28c7eb2776 -r 7f083dfae62b OrthancServer/OrthancRestApi/OrthancRestModalities.cpp --- 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 diff -r 2f28c7eb2776 -r 7f083dfae62b Resources/CMake/OrthancFrameworkParameters.cmake --- 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") #####################################################################