diff OrthancServer/Sources/main.cpp @ 4502:e3e759cbd19c

refactoring IStoreRequestHandler
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 09 Feb 2021 15:50:14 +0100
parents 8efeaba1b7f9
children 7d1eabfac6e0
line wrap: on
line diff
--- a/OrthancServer/Sources/main.cpp	Tue Feb 09 15:24:36 2021 +0100
+++ b/OrthancServer/Sources/main.cpp	Tue Feb 09 15:50:14 2021 +0100
@@ -83,13 +83,27 @@
   }
 
 
-  virtual void Handle(const std::string& dicomFile,
-                      const DicomMap& dicomSummary,
-                      const Json::Value& dicomJson,
+  virtual void Handle(DcmDataset& dicom,
                       const std::string& remoteIp,
                       const std::string& remoteAet,
                       const std::string& calledAet) ORTHANC_OVERRIDE 
   {
+    DicomMap dicomSummary;
+    Json::Value dicomJson;
+    std::string dicomFile;
+
+    const std::set<DicomTag> ignoreTagLength;
+
+    // TODO => Parameters in class "DicomServer"
+    FromDcmtkBridge::ExtractDicomSummary(dicomSummary, dicom, ORTHANC_MAXIMUM_TAG_LENGTH, ignoreTagLength);
+    FromDcmtkBridge::ExtractDicomAsJson(dicomJson, dicom, DicomToJsonFormat_Full,
+                                        DicomToJsonFlags_Default, ORTHANC_MAXIMUM_TAG_LENGTH, ignoreTagLength);
+
+    if (!FromDcmtkBridge::SaveToMemoryBuffer(dicomFile, dicom))
+    {
+      throw OrthancException(ErrorCode_InternalError, "Cannot write DICOM file to memory");
+    }
+    
     if (dicomFile.size() > 0)
     {
       DicomInstanceToStore toStore;