diff Framework/ImagedVolumeParameters.cpp @ 279:77afef2cf64b

automated extraction of the imaged volume if using OpenSlide
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 12 Jul 2023 18:06:34 +0200
parents 20a730889ae2
children 5fe243cef6e9
line wrap: on
line diff
--- a/Framework/ImagedVolumeParameters.cpp	Wed Jul 12 17:12:10 2023 +0200
+++ b/Framework/ImagedVolumeParameters.cpp	Wed Jul 12 18:06:34 2023 +0200
@@ -27,25 +27,54 @@
 
 namespace OrthancWSI
 {
-  ImagedVolumeParameters::ImagedVolumeParameters()
+  ImagedVolumeParameters::ImagedVolumeParameters() :
+    hasWidth_(false),
+    hasHeight_(false)
   {
-    // Typical parameters of a specimen millimeters
-    width_ = 15;
-    height_ = 15;
+    // Typical parameters for a specimen, in millimeters
     depth_ = 1;
     offsetX_ = 20;
     offsetY_ = 40;
   }
 
 
+  float ImagedVolumeParameters::GetWidth() const
+  {
+    if (hasWidth_)
+    {
+      return width_;
+    }
+    else
+    {
+      return 15;  // Typical width of a specimen
+    }
+  }
+
+
+  float ImagedVolumeParameters::GetHeight() const
+  {
+    if (hasHeight_)
+    {
+      return height_;
+    }
+    else
+    {
+      return 15;  // Typical height of a specimen
+    }
+  }
+
+
   void ImagedVolumeParameters::SetWidth(float width)
   {
     if (width <= 0)
     {
       throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
     }
-
-    width_ = width;
+    else
+    {
+      width_ = width;
+      hasWidth_ = true;
+    }
   }
     
 
@@ -55,8 +84,11 @@
     {
       throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
     }
-
-    height_ = height;
+    else
+    {
+      height_ = height;
+      hasHeight_ = true;
+    }
   }