diff Framework/Radiography/RadiographyMaskLayer.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 69177b10e2b9
line wrap: on
line diff
--- a/Framework/Radiography/RadiographyMaskLayer.cpp	Fri Nov 29 21:22:21 2019 +0100
+++ b/Framework/Radiography/RadiographyMaskLayer.cpp	Fri Nov 29 21:24:29 2019 +0100
@@ -112,15 +112,19 @@
 
       Orthanc::Image tmp(Orthanc::PixelFormat_Grayscale8, buffer.GetWidth(), buffer.GetHeight(), false);
 
-      t.Apply(tmp, cropped, ImageInterpolation_Nearest, true /* clear */);
 
       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, ImageInterpolation_Nearest, true /* clear */);
 
       // we have observed vertical lines at the image border (probably due to bilinear filtering of the DICOM image when it is not aligned with the buffer pixels)
       // -> draw the mask one line further on each side