comparison 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
comparison
equal deleted inserted replaced
3815:c81ac6ff232b 3818:4f78da5613a1
48 #include "../Plugins/Engine/OrthancPlugins.h" 48 #include "../Plugins/Engine/OrthancPlugins.h"
49 #include "OrthancConfiguration.h" 49 #include "OrthancConfiguration.h"
50 #include "OrthancFindRequestHandler.h" 50 #include "OrthancFindRequestHandler.h"
51 #include "OrthancInitialization.h" 51 #include "OrthancInitialization.h"
52 #include "OrthancMoveRequestHandler.h" 52 #include "OrthancMoveRequestHandler.h"
53 #include "OrthancGetRequestHandler.h"
53 #include "ServerContext.h" 54 #include "ServerContext.h"
54 #include "ServerJobs/StorageCommitmentScpJob.h" 55 #include "ServerJobs/StorageCommitmentScpJob.h"
55 #include "ServerToolbox.h" 56 #include "ServerToolbox.h"
56 #include "StorageCommitmentReports.h" 57 #include "StorageCommitmentReports.h"
57 58
188 189
189 190
190 class MyDicomServerFactory : 191 class MyDicomServerFactory :
191 public IStoreRequestHandlerFactory, 192 public IStoreRequestHandlerFactory,
192 public IFindRequestHandlerFactory, 193 public IFindRequestHandlerFactory,
193 public IMoveRequestHandlerFactory, 194 public IMoveRequestHandlerFactory,
195 public IGetRequestHandlerFactory,
194 public IStorageCommitmentRequestHandlerFactory 196 public IStorageCommitmentRequestHandlerFactory
195 { 197 {
196 private: 198 private:
197 ServerContext& context_; 199 ServerContext& context_;
198 200
241 243
242 virtual IMoveRequestHandler* ConstructMoveRequestHandler() 244 virtual IMoveRequestHandler* ConstructMoveRequestHandler()
243 { 245 {
244 return new OrthancMoveRequestHandler(context_); 246 return new OrthancMoveRequestHandler(context_);
245 } 247 }
246 248
249 virtual IGetRequestHandler* ConstructGetRequestHandler()
250 {
251 return new OrthancGetRequestHandler(context_);
252 }
253
247 virtual IStorageCommitmentRequestHandler* ConstructStorageCommitmentRequestHandler() 254 virtual IStorageCommitmentRequestHandler* ConstructStorageCommitmentRequestHandler()
248 { 255 {
249 return new OrthancStorageCommitmentRequestHandler(context_); 256 return new OrthancStorageCommitmentRequestHandler(context_);
250 } 257 }
258
251 259
252 void Done() 260 void Done()
253 { 261 {
254 } 262 }
255 }; 263 };
758 PrintErrorCode(ErrorCode_DatabaseNotInitialized, "Plugin trying to call the database during its initialization"); 766 PrintErrorCode(ErrorCode_DatabaseNotInitialized, "Plugin trying to call the database during its initialization");
759 PrintErrorCode(ErrorCode_SslDisabled, "Orthanc has been built without SSL support"); 767 PrintErrorCode(ErrorCode_SslDisabled, "Orthanc has been built without SSL support");
760 PrintErrorCode(ErrorCode_CannotOrderSlices, "Unable to order the slices of the series"); 768 PrintErrorCode(ErrorCode_CannotOrderSlices, "Unable to order the slices of the series");
761 PrintErrorCode(ErrorCode_NoWorklistHandler, "No request handler factory for DICOM C-Find Modality SCP"); 769 PrintErrorCode(ErrorCode_NoWorklistHandler, "No request handler factory for DICOM C-Find Modality SCP");
762 PrintErrorCode(ErrorCode_AlreadyExistingTag, "Cannot override the value of a tag that already exists"); 770 PrintErrorCode(ErrorCode_AlreadyExistingTag, "Cannot override the value of a tag that already exists");
771 PrintErrorCode(ErrorCode_NoCGetHandler, "No request handler factory for DICOM C-GET SCP");
763 PrintErrorCode(ErrorCode_NoStorageCommitmentHandler, "No request handler factory for DICOM N-ACTION SCP (storage commitment)"); 772 PrintErrorCode(ErrorCode_NoStorageCommitmentHandler, "No request handler factory for DICOM N-ACTION SCP (storage commitment)");
764 PrintErrorCode(ErrorCode_UnsupportedMediaType, "Unsupported media type"); 773 PrintErrorCode(ErrorCode_UnsupportedMediaType, "Unsupported media type");
765 } 774 }
766 775
767 std::cout << std::endl; 776 std::cout << std::endl;
1030 static bool StartDicomServer(ServerContext& context, 1039 static bool StartDicomServer(ServerContext& context,
1031 OrthancRestApi& restApi, 1040 OrthancRestApi& restApi,
1032 OrthancPlugins* plugins) 1041 OrthancPlugins* plugins)
1033 { 1042 {
1034 bool dicomServerEnabled; 1043 bool dicomServerEnabled;
1044 bool dicomCGetEnabled;
1035 1045
1036 { 1046 {
1037 OrthancConfiguration::ReaderLock lock; 1047 OrthancConfiguration::ReaderLock lock;
1038 dicomServerEnabled = lock.GetConfiguration().GetBooleanParameter("DicomServerEnabled", true); 1048 dicomServerEnabled = lock.GetConfiguration().GetBooleanParameter("DicomServerEnabled", true);
1049 dicomCGetEnabled = lock.GetConfiguration().GetBooleanParameter("DicomEnableCGet", false);
1039 } 1050 }
1040 1051
1041 if (!dicomServerEnabled) 1052 if (!dicomServerEnabled)
1042 { 1053 {
1043 LOG(WARNING) << "The DICOM server is disabled"; 1054 LOG(WARNING) << "The DICOM server is disabled";
1052 // Setup the DICOM server 1063 // Setup the DICOM server
1053 DicomServer dicomServer; 1064 DicomServer dicomServer;
1054 dicomServer.SetRemoteModalities(modalities); 1065 dicomServer.SetRemoteModalities(modalities);
1055 dicomServer.SetStoreRequestHandlerFactory(serverFactory); 1066 dicomServer.SetStoreRequestHandlerFactory(serverFactory);
1056 dicomServer.SetMoveRequestHandlerFactory(serverFactory); 1067 dicomServer.SetMoveRequestHandlerFactory(serverFactory);
1068 if (dicomCGetEnabled)
1069 {
1070 dicomServer.SetGetRequestHandlerFactory(serverFactory);
1071 }
1057 dicomServer.SetFindRequestHandlerFactory(serverFactory); 1072 dicomServer.SetFindRequestHandlerFactory(serverFactory);
1058 dicomServer.SetStorageCommitmentRequestHandlerFactory(serverFactory); 1073 dicomServer.SetStorageCommitmentRequestHandlerFactory(serverFactory);
1059 1074
1060 { 1075 {
1061 OrthancConfiguration::ReaderLock lock; 1076 OrthancConfiguration::ReaderLock lock;
1136 { 1151 {
1137 assert(context.HasPlugins()); 1152 assert(context.HasPlugins());
1138 context.GetHttpHandler().Register(*plugins, false); 1153 context.GetHttpHandler().Register(*plugins, false);
1139 } 1154 }
1140 #endif 1155 #endif
1141 1156
1142 // Secondly, apply the "static resources" layer 1157 // Secondly, apply the "static resources" layer
1143 #if ORTHANC_STANDALONE == 1 1158 #if ORTHANC_STANDALONE == 1
1144 EmbeddedResourceHttpHandler staticResources("/app", EmbeddedResources::ORTHANC_EXPLORER); 1159 EmbeddedResourceHttpHandler staticResources("/app", EmbeddedResources::ORTHANC_EXPLORER);
1145 #else 1160 #else
1146 FilesystemHttpHandler staticResources("/app", ORTHANC_PATH "/OrthancExplorer"); 1161 FilesystemHttpHandler staticResources("/app", ORTHANC_PATH "/OrthancExplorer");