diff OrthancServer/main.cpp @ 3818:4f78da5613a1 c-get

Add C-GET SCP support
author Stacy Loesch <stacy.loesch@varian.com>
date Fri, 27 Mar 2020 10:06:58 -0400
parents 9fe1d64a748c
children 3ab2d48c8f69
line wrap: on
line diff
--- a/OrthancServer/main.cpp	Wed Apr 08 14:01:37 2020 +0200
+++ b/OrthancServer/main.cpp	Fri Mar 27 10:06:58 2020 -0400
@@ -50,6 +50,7 @@
 #include "OrthancFindRequestHandler.h"
 #include "OrthancInitialization.h"
 #include "OrthancMoveRequestHandler.h"
+#include "OrthancGetRequestHandler.h"
 #include "ServerContext.h"
 #include "ServerJobs/StorageCommitmentScpJob.h"
 #include "ServerToolbox.h"
@@ -190,7 +191,8 @@
 class MyDicomServerFactory : 
   public IStoreRequestHandlerFactory,
   public IFindRequestHandlerFactory, 
-  public IMoveRequestHandlerFactory, 
+  public IMoveRequestHandlerFactory,
+  public IGetRequestHandlerFactory,
   public IStorageCommitmentRequestHandlerFactory
 {
 private:
@@ -243,11 +245,17 @@
   {
     return new OrthancMoveRequestHandler(context_);
   }
-
+  
+  virtual IGetRequestHandler* ConstructGetRequestHandler()
+  {
+    return new OrthancGetRequestHandler(context_);
+  }
+  
   virtual IStorageCommitmentRequestHandler* ConstructStorageCommitmentRequestHandler()
   {
     return new OrthancStorageCommitmentRequestHandler(context_);
   }
+  
 
   void Done()
   {
@@ -760,6 +768,7 @@
     PrintErrorCode(ErrorCode_CannotOrderSlices, "Unable to order the slices of the series");
     PrintErrorCode(ErrorCode_NoWorklistHandler, "No request handler factory for DICOM C-Find Modality SCP");
     PrintErrorCode(ErrorCode_AlreadyExistingTag, "Cannot override the value of a tag that already exists");
+    PrintErrorCode(ErrorCode_NoCGetHandler, "No request handler factory for DICOM C-GET SCP");
     PrintErrorCode(ErrorCode_NoStorageCommitmentHandler, "No request handler factory for DICOM N-ACTION SCP (storage commitment)");
     PrintErrorCode(ErrorCode_UnsupportedMediaType, "Unsupported media type");
   }
@@ -1032,10 +1041,12 @@
                              OrthancPlugins* plugins)
 {
   bool dicomServerEnabled;
+  bool dicomCGetEnabled;
 
   {
     OrthancConfiguration::ReaderLock lock;
     dicomServerEnabled = lock.GetConfiguration().GetBooleanParameter("DicomServerEnabled", true);
+    dicomCGetEnabled = lock.GetConfiguration().GetBooleanParameter("DicomEnableCGet", false);
   }
 
   if (!dicomServerEnabled)
@@ -1054,6 +1065,10 @@
     dicomServer.SetRemoteModalities(modalities);
     dicomServer.SetStoreRequestHandlerFactory(serverFactory);
     dicomServer.SetMoveRequestHandlerFactory(serverFactory);
+    if (dicomCGetEnabled)
+    {
+      dicomServer.SetGetRequestHandlerFactory(serverFactory);
+    }
     dicomServer.SetFindRequestHandlerFactory(serverFactory);
     dicomServer.SetStorageCommitmentRequestHandlerFactory(serverFactory);
 
@@ -1138,7 +1153,7 @@
     context.GetHttpHandler().Register(*plugins, false);
   }
 #endif
-
+  
   // Secondly, apply the "static resources" layer
 #if ORTHANC_STANDALONE == 1
   EmbeddedResourceHttpHandler staticResources("/app", EmbeddedResources::ORTHANC_EXPLORER);