diff OrthancServer/DicomInstanceToStore.cpp @ 1822:9ed9458aa44f

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 25 Nov 2015 10:06:50 +0100
parents bdfae6e17d23
children 0ef4e6e66b56
line wrap: on
line diff
--- a/OrthancServer/DicomInstanceToStore.cpp	Tue Nov 24 17:46:32 2015 +0100
+++ b/OrthancServer/DicomInstanceToStore.cpp	Wed Nov 25 10:06:50 2015 +0100
@@ -63,18 +63,23 @@
     {
       if (!parsed_.HasContent())
       {
-        throw OrthancException(ErrorCode_NotImplemented);
+        if (!summary_.HasContent())
+        {
+          throw OrthancException(ErrorCode_NotImplemented);
+        }
+        else
+        {
+          parsed_.TakeOwnership(new ParsedDicomFile(summary_.GetConstContent()));
+        }                                
       }
-      else
+
+      // Serialize the parsed DICOM file
+      buffer_.Allocate();
+      if (!FromDcmtkBridge::SaveToMemoryBuffer(buffer_.GetContent(), 
+                                               *parsed_.GetContent().GetDcmtkObject().getDataset()))
       {
-        // Serialize the parsed DICOM file
-        buffer_.Allocate();
-        if (!FromDcmtkBridge::SaveToMemoryBuffer(buffer_.GetContent(), 
-                                                 *parsed_.GetContent().GetDcmtkObject().getDataset()))
-        {
-          LOG(ERROR) << "Unable to serialize a DICOM file to a memory buffer";
-          throw OrthancException(ErrorCode_InternalError);
-        }
+        LOG(ERROR) << "Unable to serialize a DICOM file to a memory buffer";
+        throw OrthancException(ErrorCode_InternalError);
       }
     }