changeset 3830:447880856ce8

removing deprecated DicomUserControl from OrthancRestModalities.cpp
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 10 Apr 2020 17:29:11 +0200
parents 3d1bb2193832
children 83ea6939293d
files Core/DicomNetworking/DicomAssociation.cpp Core/DicomNetworking/DicomControlUserConnection.cpp Core/DicomNetworking/DicomControlUserConnection.h OrthancServer/OrthancRestApi/OrthancRestModalities.cpp
diffstat 4 files changed, 31 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/Core/DicomNetworking/DicomAssociation.cpp	Fri Apr 10 16:35:41 2020 +0200
+++ b/Core/DicomNetworking/DicomAssociation.cpp	Fri Apr 10 17:29:11 2020 +0200
@@ -209,7 +209,7 @@
     {
       return;  // Already open
     }
-      
+
     // Timeout used during association negociation and ASC_releaseAssociation()
     uint32_t acseTimeout = parameters.GetTimeout();
     if (acseTimeout == 0)
--- a/Core/DicomNetworking/DicomControlUserConnection.cpp	Fri Apr 10 16:35:41 2020 +0200
+++ b/Core/DicomNetworking/DicomControlUserConnection.cpp	Fri Apr 10 17:29:11 2020 +0200
@@ -431,6 +431,15 @@
   }
     
 
+  DicomControlUserConnection::DicomControlUserConnection(const std::string& localAet,
+                                                         const RemoteModalityParameters& remote) :
+    parameters_(localAet, remote),
+    association_(new DicomAssociation)
+  {
+    SetupPresentationContexts();
+  }
+    
+
   bool DicomControlUserConnection::Echo()
   {
     association_->Open(parameters_);
--- a/Core/DicomNetworking/DicomControlUserConnection.h	Fri Apr 10 16:35:41 2020 +0200
+++ b/Core/DicomNetworking/DicomControlUserConnection.h	Fri Apr 10 17:29:11 2020 +0200
@@ -65,6 +65,9 @@
                       const DicomMap& fields);
     
   public:
+    DicomControlUserConnection(const std::string& localAet,
+                               const RemoteModalityParameters& remote);
+    
     DicomControlUserConnection(const DicomAssociationParameters& params);
     
     const DicomAssociationParameters& GetParameters() const
--- a/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp	Fri Apr 10 16:35:41 2020 +0200
+++ b/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp	Fri Apr 10 17:29:11 2020 +0200
@@ -35,6 +35,8 @@
 #include "OrthancRestApi.h"
 
 #include "../../Core/Cache/SharedArchive.h"
+#include "../../Core/DicomNetworking/DicomAssociation.h"
+#include "../../Core/DicomNetworking/DicomControlUserConnection.h"
 #include "../../Core/DicomParsing/FromDcmtkBridge.h"
 #include "../../Core/Logging.h"
 #include "../../Core/SerializationToolbox.h"
@@ -80,8 +82,7 @@
 
     try
     {
-      DicomUserConnection connection(localAet, remote);
-      connection.Open();
+      DicomControlUserConnection connection(localAet, remote);
       
       if (connection.Echo())
       {
@@ -127,7 +128,7 @@
 
 
   static void FindPatient(DicomFindAnswers& result,
-                          DicomUserConnection& connection,
+                          DicomControlUserConnection& connection,
                           const DicomMap& fields)
   {
     // Only keep the filters from "fields" that are related to the patient
@@ -138,7 +139,7 @@
 
 
   static void FindStudy(DicomFindAnswers& result,
-                        DicomUserConnection& connection,
+                        DicomControlUserConnection& connection,
                         const DicomMap& fields)
   {
     // Only keep the filters from "fields" that are related to the study
@@ -153,7 +154,7 @@
   }
 
   static void FindSeries(DicomFindAnswers& result,
-                         DicomUserConnection& connection,
+                         DicomControlUserConnection& connection,
                          const DicomMap& fields)
   {
     // Only keep the filters from "fields" that are related to the series
@@ -168,7 +169,7 @@
   }
 
   static void FindInstance(DicomFindAnswers& result,
-                           DicomUserConnection& connection,
+                           DicomControlUserConnection& connection,
                            const DicomMap& fields)
   {
     // Only keep the filters from "fields" that are related to the instance
@@ -203,8 +204,7 @@
     DicomFindAnswers answers(false);
 
     {
-      DicomUserConnection connection(localAet, remote);
-      connection.Open();
+      DicomControlUserConnection connection(localAet, remote);
       FindPatient(answers, connection, fields);
     }
 
@@ -238,8 +238,7 @@
     DicomFindAnswers answers(false);
 
     {
-      DicomUserConnection connection(localAet, remote);
-      connection.Open();
+      DicomControlUserConnection connection(localAet, remote);
       FindStudy(answers, connection, fields);
     }
 
@@ -274,8 +273,7 @@
     DicomFindAnswers answers(false);
 
     {
-      DicomUserConnection connection(localAet, remote);
-      connection.Open();
+      DicomControlUserConnection connection(localAet, remote);
       FindSeries(answers, connection, fields);
     }
 
@@ -311,8 +309,7 @@
     DicomFindAnswers answers(false);
 
     {
-      DicomUserConnection connection(localAet, remote);
-      connection.Open();
+      DicomControlUserConnection connection(localAet, remote);
       FindInstance(answers, connection, fields);
     }
 
@@ -350,8 +347,7 @@
     RemoteModalityParameters remote =
       MyGetModalityUsingSymbolicName(call.GetUriComponent("id", ""));
 
-    DicomUserConnection connection(localAet, remote);
-    connection.Open();
+    DicomControlUserConnection connection(localAet, remote);
     
     DicomFindAnswers patients(false);
     FindPatient(patients, connection, m);
@@ -804,7 +800,7 @@
         DicomMap answer;
         parent.GetHandler().GetAnswer(answer, index);
 
-        // This switch-case mimics "DicomUserConnection::Move()"
+        // This switch-case mimics "DicomControlUserConnection::Move()"
         switch (parent.GetHandler().GetLevel())
         {
           case ResourceType_Patient:
@@ -1031,8 +1027,7 @@
     const RemoteModalityParameters source =
       MyGetModalityUsingSymbolicName(call.GetUriComponent("id", ""));
 
-    DicomUserConnection connection(localAet, source);
-    connection.Open();
+    DicomControlUserConnection connection(localAet, source);
     
     for (Json::Value::ArrayIndex i = 0; i < request[KEY_RESOURCES].size(); i++)
     {
@@ -1315,8 +1310,7 @@
       DicomFindAnswers answers(true);
 
       {
-        DicomUserConnection connection(localAet, remote);
-        connection.Open();
+        DicomControlUserConnection connection(localAet, remote);
         connection.FindWorklist(answers, *query);
       }
 
@@ -1486,11 +1480,11 @@
         context.GetStorageCommitmentReports().Store(
           transactionUid, new StorageCommitmentReports::Report(remoteAet));
 
-        DicomUserConnection scu(localAet, remote);
-
+        DicomAssociationParameters parameters(localAet, remote);
+        
         std::vector<std::string> a(sopClassUids.begin(), sopClassUids.end());
         std::vector<std::string> b(sopInstanceUids.begin(), sopInstanceUids.end());
-        scu.RequestStorageCommitment(transactionUid, a, b);
+        DicomAssociation::RequestStorageCommitment(parameters, transactionUid, a, b);
       }
 
       Json::Value result = Json::objectValue;