diff Framework/Radiography/RadiographyAlphaLayer.cpp @ 1204:b519c1c878f1 broker

integration mainline->broker
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 29 Nov 2019 21:24:29 +0100
parents ab958fd99b07
children 355dba5352d7
line wrap: on
line diff
--- a/Framework/Radiography/RadiographyAlphaLayer.cpp	Fri Nov 29 21:22:21 2019 +0100
+++ b/Framework/Radiography/RadiographyAlphaLayer.cpp	Fri Nov 29 21:24:29 2019 +0100
@@ -79,15 +79,19 @@
 
     Orthanc::Image tmp(Orthanc::PixelFormat_Grayscale8, buffer.GetWidth(), buffer.GetHeight(), false);
 
-    t.Apply(tmp, cropped, interpolation, true /* clear */);
+    unsigned int x1, y1, x2, y2;
 
-    unsigned int x1, y1, x2, y2;
-    OrthancStone::GetProjectiveTransformExtent(x1, y1, x2, y2,
-                                               t.GetHomogeneousMatrix(),
-                                               cropped.GetWidth(),
-                                               cropped.GetHeight(),
-                                               buffer.GetWidth(),
-                                               buffer.GetHeight());
+    if (!OrthancStone::GetProjectiveTransformExtent(x1, y1, x2, y2,
+                                                    t.GetHomogeneousMatrix(),
+                                                    cropped.GetWidth(),
+                                                    cropped.GetHeight(),
+                                                    buffer.GetWidth(),
+                                                    buffer.GetHeight()))
+    {
+      return;  // layer is outside the buffer
+    }
+
+    t.Apply(tmp, cropped, interpolation, true /* clear */);
 
     float value = foreground_;