diff OrthancServer/Sources/DicomInstanceToStore.cpp @ 4507:b4c58795f3a8

widening the use of DicomTransferSyntax enum
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 11 Feb 2021 09:33:48 +0100
parents ac69c9f76c71
children 8f9090b137f1
line wrap: on
line diff
--- a/OrthancServer/Sources/DicomInstanceToStore.cpp	Wed Feb 10 17:01:44 2021 +0100
+++ b/OrthancServer/Sources/DicomInstanceToStore.cpp	Thu Feb 11 09:33:48 2021 +0100
@@ -267,7 +267,7 @@
     }
 
 
-    bool LookupTransferSyntax(std::string& result)
+    bool LookupTransferSyntax(DicomTransferSyntax& result)
     {
       DicomMap header;
       if (DicomMap::ParseDicomMetaInformation(header, GetBufferData(), GetBufferSize()))
@@ -277,8 +277,7 @@
             !value->IsBinary() &&
             !value->IsNull())
         {
-          result = Toolbox::StripSpaces(value->GetContent());
-          return true;
+          return ::Orthanc::LookupTransferSyntax(result, Toolbox::StripSpaces(value->GetContent()));
         }
       }
       else
@@ -286,12 +285,7 @@
         // This is a DICOM file without a proper meta-header. Fallback
         // to DCMTK, which will fully parse the dataset to retrieve
         // the transfer syntax. Added in Orthanc 1.8.2.
-        std::string transferSyntax;
-        if (GetParsedDicomFile().LookupTransferSyntax(transferSyntax))
-        {
-          result = Toolbox::StripSpaces(transferSyntax);
-          return true;
-        }
+        return GetParsedDicomFile().LookupTransferSyntax(result);
       }
 
       return false;
@@ -377,7 +371,7 @@
   }
 
 
-  bool DicomInstanceToStore::LookupTransferSyntax(std::string& result) const
+  bool DicomInstanceToStore::LookupTransferSyntax(DicomTransferSyntax& result) const
   {
     return const_cast<PImpl&>(*pimpl_).LookupTransferSyntax(result);
   }
@@ -392,4 +386,32 @@
   {
     return const_cast<PImpl&>(*pimpl_).GetParsedDicomFile();
   }
+
+  void DicomInstanceToStore::GetSummary(DicomMap& summary) const
+  {
+    OrthancConfiguration::DefaultExtractDicomSummary(summary, GetParsedDicomFile());
+  }
+
+  void DicomInstanceToStore::GetDicomAsJson(Json::Value& dicomAsJson) const
+  {
+    OrthancConfiguration::DefaultDicomDatasetToJson(dicomAsJson, GetParsedDicomFile());
+  }
+
+  void DicomInstanceToStore::DatasetToJson(Json::Value& target, 
+                                           DicomToJsonFormat format,
+                                           DicomToJsonFlags flags,
+                                           unsigned int maxStringLength) const
+  {
+    return GetParsedDicomFile().DatasetToJson(target, format, flags, maxStringLength);
+  }
+
+  unsigned int DicomInstanceToStore::GetFramesCount() const
+  {
+    return GetParsedDicomFile().GetFramesCount();
+  }
+    
+  ImageAccessor* DicomInstanceToStore::DecodeFrame(unsigned int frame) const
+  {
+    return GetParsedDicomFile().DecodeFrame(frame);
+  }
 }