changeset 1221:e2435a524029

merge
author Alain Mazy <alain@mazy.be>
date Sat, 07 Dec 2019 17:47:35 +0100
parents 9ee6b28f53e8 (current diff) b5dec783ba08 (diff)
children 04fd875b91f4 355dba5352d7
files
diffstat 6 files changed, 41 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Scene2D/GrayscaleStyleConfigurator.cpp	Sat Dec 07 17:47:23 2019 +0100
+++ b/Framework/Scene2D/GrayscaleStyleConfigurator.cpp	Sat Dec 07 17:47:35 2019 +0100
@@ -29,7 +29,7 @@
 {
   void GrayscaleStyleConfigurator::SetWindowing(ImageWindowing windowing)
   {
-    hasWindowing_ = true;
+    hasWindowingOverride_ = true;
     windowing_ = windowing;
     revision_++;
   }
@@ -49,6 +49,7 @@
 
   void GrayscaleStyleConfigurator::SetInverted(bool inverted)
   {
+    hasInversionOverride_ = true;
     inverted_ = inverted;
     revision_++;
   }
@@ -88,7 +89,7 @@
     
     l.SetLinearInterpolation(linearInterpolation_);
 
-    if (hasWindowing_)
+    if (hasWindowingOverride_)
     {
       if (windowing_ != ImageWindowing_Custom)
       {
@@ -99,6 +100,9 @@
         l.SetCustomWindowing(customWindowCenter_, customWindowWidth_);
       }
     }
-    l.SetInverted(inverted_);
+    if (hasInversionOverride_)
+    {
+      l.SetInverted(inverted_);
+    }
   }
 }
--- a/Framework/Scene2D/GrayscaleStyleConfigurator.h	Sat Dec 07 17:47:23 2019 +0100
+++ b/Framework/Scene2D/GrayscaleStyleConfigurator.h	Sat Dec 07 17:47:35 2019 +0100
@@ -34,19 +34,21 @@
   private:
     uint64_t        revision_;
     bool            linearInterpolation_;
-    bool            hasWindowing_;
+    bool            hasWindowingOverride_;
     ImageWindowing  windowing_;
     float           customWindowWidth_;
     float           customWindowCenter_;
+    bool            hasInversionOverride_;
     bool            inverted_;
     
   public:
     GrayscaleStyleConfigurator() :
       revision_(0),
       linearInterpolation_(false),
-      hasWindowing_(false),
+      hasWindowingOverride_(false),
       customWindowWidth_(0),
       customWindowCenter_(0),
+      hasInversionOverride_(false),
       inverted_(false)
     {
     }
--- a/Framework/Scene2DViewport/MeasureToolsToolbox.cpp	Sat Dec 07 17:47:23 2019 +0100
+++ b/Framework/Scene2DViewport/MeasureToolsToolbox.cpp	Sat Dec 07 17:47:35 2019 +0100
@@ -65,6 +65,11 @@
     const ScenePoint2D& centerS,
     const double& sideLengthS)
   {
+    /*
+    The scene is required here because we need to draw the square with its
+    sides parallel to the SCREEN axis, not the SCENE axis
+    */
+
     // get the scaling factor 
     const double sceneToCanvas =
       scene.GetSceneToCanvasTransform().ComputeZoom();
@@ -204,9 +209,9 @@
 #endif
 
   void AddCircle(PolylineSceneLayer::Chain& chain,
-    const ScenePoint2D& centerS,
-    const double& radiusS,
-    const int           numSubdivisions)
+                 const ScenePoint2D&        centerS,
+                 const double&              radiusS,
+                 const int                  numSubdivisions)
   {
     //ScenePoint2D centerC = centerS.Apply(scene.GetSceneToCanvasTransform());
     //TODO: take DPI into account
--- a/Framework/Scene2DViewport/MeasureToolsToolbox.h	Sat Dec 07 17:47:23 2019 +0100
+++ b/Framework/Scene2DViewport/MeasureToolsToolbox.h	Sat Dec 07 17:47:35 2019 +0100
@@ -31,9 +31,9 @@
   square sides are parallel to the canvas boundaries.
   */
   void AddSquare(PolylineSceneLayer::Chain& chain,
-                 const Scene2D&     scene,
-                 const ScenePoint2D& centerS,
-                 const double& sideLengthS);
+                 const Scene2D&             scene,
+                 const ScenePoint2D&        centerS,
+                 const double&              sideLengthS);
 
   /**
     Creates an arc centered on c that goes
@@ -123,10 +123,9 @@
     Warning: the existing chain content will be wiped out.
   */
   void AddCircle(PolylineSceneLayer::Chain& chain,
-    const Scene2D& scene,
-    const ScenePoint2D& centerS,
-    const double& radiusS,
-    const int           numSubdivisions = 63);
+                 const ScenePoint2D&        centerS,
+                 const double&              radiusS,
+                 const int                  numSubdivisions = 63);
 
   /**
     Adds or subtracts 2*pi as many times as need to shift the specified
@@ -146,9 +145,7 @@
 
   */
   double MeasureAngle(
-    const ScenePoint2D& p1
-    , const ScenePoint2D& c
-    , const ScenePoint2D& p2);
+    const ScenePoint2D& p1, const ScenePoint2D& c, const ScenePoint2D& p2);
 
   /**
   RadiansToDegrees
--- a/Framework/Toolbox/AffineTransform2D.h	Sat Dec 07 17:47:23 2019 +0100
+++ b/Framework/Toolbox/AffineTransform2D.h	Sat Dec 07 17:47:35 2019 +0100
@@ -77,7 +77,8 @@
                                      const AffineTransform2D& c,
                                      const AffineTransform2D& d);
 
-    // transformations are applied right to left: e is the first transfo applied, a is the last one
+    // transformations are applied right to left: 
+    // `e` is the first transformation applied and `a` is the last one
     static AffineTransform2D Combine(const AffineTransform2D& a,
                                      const AffineTransform2D& b,
                                      const AffineTransform2D& c,
--- a/Framework/Toolbox/DicomInstanceParameters.cpp	Sat Dec 07 17:47:23 2019 +0100
+++ b/Framework/Toolbox/DicomInstanceParameters.cpp	Sat Dec 07 17:47:35 2019 +0100
@@ -420,7 +420,19 @@
         texture->SetCustomWindowing(data_.defaultWindowingCenter_,
                                     data_.defaultWindowingWidth_);
       }
-        
+      
+
+      if (data_.imageInformation_.GetPhotometricInterpretation()
+        == Orthanc::PhotometricInterpretation_Monochrome1)
+      {
+        texture->SetInverted(true);
+      }
+      else if (data_.imageInformation_.GetPhotometricInterpretation()
+        == Orthanc::PhotometricInterpretation_Monochrome2)
+      {
+        texture->SetInverted(false);
+      }
+
       return texture.release();
     }
   }