# HG changeset patch # User sylvain.rouquette@incepto-medical.com # Date 1584518346 -3600 # Node ID 763533d6dd67f6e60df921c07a3df6581592d46d # Parent 4beabcea3a5cb79506ca1f9cd28d6a6b8c7b7f03 add PreferredTransferSyntax to RemoteModalityParameters DicomUserConnection can now use RemoteModalityParameters.PreferredTransferSyntax instead of using the default transfer syntax (LE-implicit). This way we can transcode by default in LE-explicit. fix issue #169 diff -r 4beabcea3a5c -r 763533d6dd67 Core/DicomNetworking/DicomUserConnection.cpp --- a/Core/DicomNetworking/DicomUserConnection.cpp Wed Oct 16 12:52:25 2019 +0200 +++ b/Core/DicomNetworking/DicomUserConnection.cpp Wed Mar 18 08:59:06 2020 +0100 @@ -126,7 +126,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 @@ -900,6 +900,7 @@ void DicomUserConnection::DefaultSetup() { preferredTransferSyntax_ = DEFAULT_PREFERRED_TRANSFER_SYNTAX; + modalityPreferredTransferSyntax_ = DEFAULT_PREFERRED_TRANSFER_SYNTAX; localAet_ = "STORESCU"; remoteAet_ = "ANY-SCP"; remoteHost_ = "127.0.0.1"; @@ -951,6 +952,8 @@ SetRemoteHost(parameters.GetHost()); SetRemotePort(parameters.GetPortNumber()); SetRemoteManufacturer(parameters.GetManufacturer()); + SetPreferredTransferSyntax(parameters.GetPreferredTransferSyntax()); + modalityPreferredTransferSyntax_ = parameters.GetPreferredTransferSyntax(); } @@ -983,7 +986,7 @@ void DicomUserConnection::ResetPreferredTransferSyntax() { - SetPreferredTransferSyntax(DEFAULT_PREFERRED_TRANSFER_SYNTAX); + SetPreferredTransferSyntax(modalityPreferredTransferSyntax_); } void DicomUserConnection::SetPreferredTransferSyntax(const std::string& preferredTransferSyntax) diff -r 4beabcea3a5c -r 763533d6dd67 Core/DicomNetworking/DicomUserConnection.h --- a/Core/DicomNetworking/DicomUserConnection.h Wed Oct 16 12:52:25 2019 +0200 +++ b/Core/DicomNetworking/DicomUserConnection.h Wed Mar 18 08:59:06 2020 +0100 @@ -56,6 +56,7 @@ // Connection parameters std::string preferredTransferSyntax_; + std::string modalityPreferredTransferSyntax_; std::string localAet_; std::string remoteAet_; std::string remoteHost_; diff -r 4beabcea3a5c -r 763533d6dd67 Core/DicomNetworking/RemoteModalityParameters.cpp --- a/Core/DicomNetworking/RemoteModalityParameters.cpp Wed Oct 16 12:52:25 2019 +0200 +++ b/Core/DicomNetworking/RemoteModalityParameters.cpp Wed Mar 18 08:59:06 2020 +0100 @@ -38,6 +38,8 @@ #include "../OrthancException.h" #include "../SerializationToolbox.h" +#include + #include #include @@ -49,6 +51,7 @@ static const char* KEY_ALLOW_MOVE = "AllowMove"; static const char* KEY_ALLOW_STORE = "AllowStore"; 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"; @@ -59,6 +62,7 @@ { aet_ = "ORTHANC"; host_ = "127.0.0.1"; + preferredTransferSyntax_ = UID_LittleEndianImplicitTransferSyntax; port_ = 104; manufacturer_ = ModalityManufacturer_Generic; allowEcho_ = true; @@ -167,6 +171,7 @@ aet_ = SerializationToolbox::ReadString(serialized, KEY_AET); host_ = SerializationToolbox::ReadString(serialized, KEY_HOST); + preferredTransferSyntax_ = SerializationToolbox::ReadString(serialized, KEY_PREFERRED_TRANSFER_SYNTAX); if (serialized.isMember(KEY_PORT)) { @@ -289,6 +294,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 4beabcea3a5c -r 763533d6dd67 Core/DicomNetworking/RemoteModalityParameters.h --- a/Core/DicomNetworking/RemoteModalityParameters.h Wed Oct 16 12:52:25 2019 +0200 +++ b/Core/DicomNetworking/RemoteModalityParameters.h Wed Mar 18 08:59:06 2020 +0100 @@ -46,6 +46,7 @@ private: std::string aet_; std::string host_; + std::string preferredTransferSyntax_; uint16_t port_; ModalityManufacturer manufacturer_; bool allowEcho_; @@ -53,7 +54,6 @@ bool allowFind_; bool allowMove_; bool allowGet_; - void Clear(); void UnserializeArray(const Json::Value& serialized); @@ -96,6 +96,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 4beabcea3a5c -r 763533d6dd67 UnitTestsSources/MultiThreadingTests.cpp --- a/UnitTestsSources/MultiThreadingTests.cpp Wed Oct 16 12:52:25 2019 +0200 +++ b/UnitTestsSources/MultiThreadingTests.cpp Wed Mar 18 08:59:06 2020 +0100 @@ -1411,6 +1411,7 @@ modality.SetHost("192.168.1.1"); modality.SetPortNumber(1000); modality.SetManufacturer(ModalityManufacturer_StoreScp); + modality.SetPreferredTransferSyntax("1.2.840.10008.1.2"); StoreScuOperation operation("TEST", modality); @@ -1496,6 +1497,7 @@ modality.SetHost("192.168.1.1"); modality.SetPortNumber(1000); modality.SetManufacturer(ModalityManufacturer_StoreScp); + modality.SetPreferredTransferSyntax("1.2.840.10008.1.2"); DicomModalityStoreJob job(GetContext()); job.SetLocalAet("LOCAL"); @@ -1910,6 +1912,7 @@ modality.SetHost("world"); modality.SetPortNumber(45); modality.SetManufacturer(ModalityManufacturer_Dcm4Chee); + modality.SetPreferredTransferSyntax("1.2.840.10008.1.2"); modality.Serialize(s, true); ASSERT_EQ(Json::objectValue, s.type()); }