# HG changeset patch # User Alain Mazy # Date 1575737255 -3600 # Node ID e2435a5240293801c5ed04d67013e47625aad2a0 # Parent 9ee6b28f53e804dd0227d2234214999ce5b2e994# Parent b5dec783ba0864c481cfe8dde98076f26ce9afd0 merge diff -r 9ee6b28f53e8 -r e2435a524029 Framework/Scene2D/GrayscaleStyleConfigurator.cpp --- 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_); + } } } diff -r 9ee6b28f53e8 -r e2435a524029 Framework/Scene2D/GrayscaleStyleConfigurator.h --- 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) { } diff -r 9ee6b28f53e8 -r e2435a524029 Framework/Scene2DViewport/MeasureToolsToolbox.cpp --- 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 diff -r 9ee6b28f53e8 -r e2435a524029 Framework/Scene2DViewport/MeasureToolsToolbox.h --- 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 diff -r 9ee6b28f53e8 -r e2435a524029 Framework/Toolbox/AffineTransform2D.h --- 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, diff -r 9ee6b28f53e8 -r e2435a524029 Framework/Toolbox/DicomInstanceParameters.cpp --- 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(); } }