diff Framework/Layers/SeriesFrameRendererFactory.cpp @ 32:517c46f527cd

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 19 Dec 2016 11:00:23 +0100
parents ff1e935768e7
children 7207a407bcd8
line wrap: on
line diff
--- a/Framework/Layers/SeriesFrameRendererFactory.cpp	Fri Dec 16 15:41:20 2016 +0100
+++ b/Framework/Layers/SeriesFrameRendererFactory.cpp	Mon Dec 19 11:00:23 2016 +0100
@@ -34,6 +34,11 @@
 
 #include "FrameRenderer.h"
 #include "../../Resources/Orthanc/Core/OrthancException.h"
+#include "../../Resources/Orthanc/Core/Logging.h"
+#include "../../Resources/Orthanc/Core/Toolbox.h"
+#include "../../Resources/Orthanc/Plugins/Samples/Common/OrthancPluginException.h"
+#include "../../Resources/Orthanc/Plugins/Samples/Common/DicomDatasetReader.h"
+
 
 namespace OrthancStone
 {
@@ -66,7 +71,7 @@
       throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
     }
     
-    currentDataset_->GetPixelSpacing(spacingX, spacingY);
+    GeometryToolbox::GetPixelSpacing(spacingX, spacingY, *currentDataset_);
   }
 
 
@@ -77,16 +82,23 @@
       // There was no previous call "ReadCurrentFrameDataset()"
       throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
     }
-      
-    if (currentDataset_->HasTag(DICOM_TAG_SLICE_THICKNESS))
+    
+    try
     {
-      return currentDataset_->GetFloatValue(DICOM_TAG_SLICE_THICKNESS);
+      OrthancPlugins::DicomDatasetReader reader(*currentDataset_);
+
+      double thickness;
+      if (reader.GetDoubleValue(thickness, OrthancPlugins::DICOM_TAG_SLICE_THICKNESS))
+      {
+        return thickness;
+      }
     }
-    else
+    catch (ORTHANC_PLUGINS_EXCEPTION_CLASS& e)
     {
-      // Some arbitrary large slice thickness
-      return std::numeric_limits<double>::infinity();
     }
+
+    // Some arbitrary large slice thickness
+    return std::numeric_limits<double>::infinity();
   }