Mercurial > hg > orthanc
changeset 3786:3801435e34a1 SylvainRouquette/fix-issue169-95b752c
integration Orthanc-1.6.0->SylvainRouquette
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 19 Mar 2020 11:48:30 +0100 |
parents | 763533d6dd67 (diff) 64a095d133a8 (current diff) |
children | 7c853804f3b9 |
files | Core/DicomNetworking/DicomUserConnection.cpp Core/DicomNetworking/DicomUserConnection.h Core/DicomNetworking/RemoteModalityParameters.cpp Core/DicomNetworking/RemoteModalityParameters.h Resources/Patches/dcmtk-3.6.2-cmath.patch Resources/WebAssembly/dcdict.cc Resources/WebAssembly/dcdict.h UnitTestsSources/MultiThreadingTests.cpp |
diffstat | 5 files changed, 37 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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_;
--- 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 <dcmtk/dcmdata/dcuid.h> + #include <boost/lexical_cast.hpp> #include <stdexcept> @@ -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_;
--- 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_;
--- 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()); }