changeset 3785:763533d6dd67 SylvainRouquette/fix-issue169-95b752c

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
author sylvain.rouquette@incepto-medical.com
date Wed, 18 Mar 2020 08:59:06 +0100
parents 4beabcea3a5c
children 3801435e34a1
files Core/DicomNetworking/DicomUserConnection.cpp Core/DicomNetworking/DicomUserConnection.h Core/DicomNetworking/RemoteModalityParameters.cpp Core/DicomNetworking/RemoteModalityParameters.h UnitTestsSources/MultiThreadingTests.cpp
diffstat 5 files changed, 26 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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)
--- 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_;
--- 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 <dcmtk/dcmdata/dcuid.h>
+
 #include <boost/lexical_cast.hpp>
 #include <stdexcept>
 
@@ -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_;
--- 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_;
--- 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());
   }