# HG changeset patch # User Sebastien Jodogne # Date 1584614910 -3600 # Node ID 3801435e34a1fc822af1547d99cee1da5d18fb04 # Parent 763533d6dd67f6e60df921c07a3df6581592d46d# Parent 64a095d133a8a4c5c7ac7a951821933ed2985ed0 integration Orthanc-1.6.0->SylvainRouquette diff -r 64a095d133a8 -r 3801435e34a1 Core/DicomNetworking/DicomUserConnection.cpp --- a/Core/DicomNetworking/DicomUserConnection.cpp Wed Mar 18 13:12:46 2020 +0100 +++ b/Core/DicomNetworking/DicomUserConnection.cpp Thu Mar 19 11:48:30 2020 +0100 @@ -127,7 +127,7 @@ #endif -static const char* DEFAULT_PREFERRED_TRANSFER_SYNTAX = UID_LittleEndianImplicitTransferSyntax; +static const std::string DEFAULT_PREFERRED_TRANSFER_SYNTAX = UID_LittleEndianImplicitTransferSyntax; /** * "If we have more than 64 storage SOP classes, tools such as @@ -979,6 +979,7 @@ void DicomUserConnection::DefaultSetup() { preferredTransferSyntax_ = DEFAULT_PREFERRED_TRANSFER_SYNTAX; + modalityPreferredTransferSyntax_ = DEFAULT_PREFERRED_TRANSFER_SYNTAX; localAet_ = "STORESCU"; remoteAet_ = "ANY-SCP"; remoteHost_ = "127.0.0.1"; @@ -1030,6 +1031,8 @@ SetRemoteHost(parameters.GetHost()); SetRemotePort(parameters.GetPortNumber()); SetRemoteManufacturer(parameters.GetManufacturer()); + SetPreferredTransferSyntax(parameters.GetPreferredTransferSyntax()); + modalityPreferredTransferSyntax_ = parameters.GetPreferredTransferSyntax(); } @@ -1062,7 +1065,7 @@ void DicomUserConnection::ResetPreferredTransferSyntax() { - SetPreferredTransferSyntax(DEFAULT_PREFERRED_TRANSFER_SYNTAX); + SetPreferredTransferSyntax(modalityPreferredTransferSyntax_); } void DicomUserConnection::SetPreferredTransferSyntax(const std::string& preferredTransferSyntax) diff -r 64a095d133a8 -r 3801435e34a1 Core/DicomNetworking/DicomUserConnection.h --- a/Core/DicomNetworking/DicomUserConnection.h Wed Mar 18 13:12:46 2020 +0100 +++ b/Core/DicomNetworking/DicomUserConnection.h Thu Mar 19 11:48:30 2020 +0100 @@ -63,6 +63,7 @@ // Connection parameters std::string preferredTransferSyntax_; + std::string modalityPreferredTransferSyntax_; std::string localAet_; std::string remoteAet_; std::string remoteHost_; diff -r 64a095d133a8 -r 3801435e34a1 Core/DicomNetworking/RemoteModalityParameters.cpp --- a/Core/DicomNetworking/RemoteModalityParameters.cpp Wed Mar 18 13:12:46 2020 +0100 +++ b/Core/DicomNetworking/RemoteModalityParameters.cpp Thu Mar 19 11:48:30 2020 +0100 @@ -38,6 +38,8 @@ #include "../OrthancException.h" #include "../SerializationToolbox.h" +#include + #include #include @@ -52,6 +54,7 @@ static const char* KEY_ALLOW_N_EVENT_REPORT = "AllowEventReport"; static const char* KEY_ALLOW_STORAGE_COMMITMENT = "AllowStorageCommitment"; static const char* KEY_HOST = "Host"; +static const char* KEY_PREFERRED_TRANSFER_SYNTAX = "PreferredTransferSyntax"; static const char* KEY_MANUFACTURER = "Manufacturer"; static const char* KEY_PORT = "Port"; @@ -62,6 +65,7 @@ { aet_ = "ORTHANC"; host_ = "127.0.0.1"; + preferredTransferSyntax_ = UID_LittleEndianImplicitTransferSyntax; port_ = 104; manufacturer_ = ModalityManufacturer_Generic; allowEcho_ = true; @@ -173,6 +177,11 @@ aet_ = SerializationToolbox::ReadString(serialized, KEY_AET); host_ = SerializationToolbox::ReadString(serialized, KEY_HOST); + if (serialized.isMember(KEY_PREFERRED_TRANSFER_SYNTAX)) + { + preferredTransferSyntax_ = SerializationToolbox::ReadString(serialized, KEY_PREFERRED_TRANSFER_SYNTAX); + } + if (serialized.isMember(KEY_PORT)) { port_ = ReadPortNumber(serialized[KEY_PORT]); @@ -327,6 +336,7 @@ target = Json::objectValue; target[KEY_AET] = aet_; target[KEY_HOST] = host_; + target[KEY_PREFERRED_TRANSFER_SYNTAX] = preferredTransferSyntax_; target[KEY_PORT] = port_; target[KEY_MANUFACTURER] = EnumerationToString(manufacturer_); target[KEY_ALLOW_ECHO] = allowEcho_; diff -r 64a095d133a8 -r 3801435e34a1 Core/DicomNetworking/RemoteModalityParameters.h --- a/Core/DicomNetworking/RemoteModalityParameters.h Wed Mar 18 13:12:46 2020 +0100 +++ b/Core/DicomNetworking/RemoteModalityParameters.h Thu Mar 19 11:48:30 2020 +0100 @@ -46,6 +46,7 @@ private: std::string aet_; std::string host_; + std::string preferredTransferSyntax_; uint16_t port_; ModalityManufacturer manufacturer_; bool allowEcho_; @@ -55,7 +56,7 @@ bool allowGet_; bool allowNAction_; bool allowNEventReport_; - + void Clear(); void UnserializeArray(const Json::Value& serialized); @@ -98,6 +99,16 @@ host_ = host; } + const std::string& GetPreferredTransferSyntax() const + { + return preferredTransferSyntax_; + } + + void SetPreferredTransferSyntax(const std::string& preferredTransferSyntax) + { + preferredTransferSyntax_ = preferredTransferSyntax; + } + uint16_t GetPortNumber() const { return port_; diff -r 64a095d133a8 -r 3801435e34a1 UnitTestsSources/MultiThreadingTests.cpp --- a/UnitTestsSources/MultiThreadingTests.cpp Wed Mar 18 13:12:46 2020 +0100 +++ b/UnitTestsSources/MultiThreadingTests.cpp Thu Mar 19 11:48:30 2020 +0100 @@ -1412,6 +1412,9 @@ modality.SetHost("192.168.1.1"); modality.SetPortNumber(1000); modality.SetManufacturer(ModalityManufacturer_StoreScp); + ASSERT_EQ("1.2.840.10008.1.2", modality.GetPreferredTransferSyntax()); + modality.SetPreferredTransferSyntax("1.2.840.10008.1.2.1"); + ASSERT_EQ("1.2.840.10008.1.2.1", modality.GetPreferredTransferSyntax()); StoreScuOperation operation("TEST", modality); @@ -1497,6 +1500,9 @@ modality.SetHost("192.168.1.1"); modality.SetPortNumber(1000); modality.SetManufacturer(ModalityManufacturer_StoreScp); + ASSERT_EQ("1.2.840.10008.1.2", modality.GetPreferredTransferSyntax()); + modality.SetPreferredTransferSyntax("1.2.840.10008.1.2.1"); + ASSERT_EQ("1.2.840.10008.1.2.1", modality.GetPreferredTransferSyntax()); DicomModalityStoreJob job(GetContext()); job.SetLocalAet("LOCAL"); @@ -1913,6 +1919,9 @@ modality.SetHost("world"); modality.SetPortNumber(45); modality.SetManufacturer(ModalityManufacturer_GenericNoWildcardInDates); + ASSERT_EQ("1.2.840.10008.1.2", modality.GetPreferredTransferSyntax()); + modality.SetPreferredTransferSyntax("1.2.840.10008.1.2.1"); + ASSERT_EQ("1.2.840.10008.1.2.1", modality.GetPreferredTransferSyntax()); modality.Serialize(s, true); ASSERT_EQ(Json::objectValue, s.type()); }