diff Framework/Radiography/RadiographyLayer.h @ 620:fd9b9d993fc7 am-dev

added flip to RadiographyLayer
author Alain Mazy <alain@mazy.be>
date Tue, 07 May 2019 11:15:57 +0200
parents 77e0eb83ff63
children 8d66efecd91c
line wrap: on
line diff
--- a/Framework/Radiography/RadiographyLayer.h	Mon Apr 29 12:01:55 2019 +0200
+++ b/Framework/Radiography/RadiographyLayer.h	Tue May 07 11:15:57 2019 +0200
@@ -75,6 +75,8 @@
       unsigned int       cropY_;
       unsigned int       cropWidth_;
       unsigned int       cropHeight_;
+      bool               verticalFlip_;
+      bool               horizontalFlip_;
       double             panX_;
       double             panY_;
       double             angle_;
@@ -166,6 +168,35 @@
         return pixelSpacingY_;
       }
 
+      void SetVerticalFlip(bool flip) //  mirrors image around an horizontal axis (note: flip is applied before the rotation !)
+      {
+        verticalFlip_ = flip;
+      }
+
+      void SetHorizontalFlip(bool flip) //  mirrors image around a vertical axis (note: flip is applied before the rotation !)
+      {
+        horizontalFlip_ = flip;
+      }
+
+      bool GetVerticalFlip() const
+      {
+        return verticalFlip_;
+      }
+
+      bool GetHorizontalFlip() const
+      {
+        return horizontalFlip_;
+      }
+
+      double GetScalingX() const
+      {
+        return (horizontalFlip_ ? - pixelSpacingX_: pixelSpacingX_);
+      }
+
+      double GetScalingY() const
+      {
+        return (verticalFlip_ ? - pixelSpacingY_: pixelSpacingY_);
+      }
     };
 
   private:
@@ -251,6 +282,10 @@
     void SetPan(double x,
                 double y);
 
+    void SetVerticalFlip(bool flip); //  mirrors image around an horizontal axis (note: flip is applied before the rotation !)
+
+    void SetHorizontalFlip(bool flip); //  mirrors image around a vertical axis (note: flip is applied before the rotation !)
+
     void SetResizeable(bool resizeable)
     {
       geometry_.SetResizeable(resizeable);