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

integration mainline->broker
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 29 Nov 2019 21:24:29 +0100
parents 54cbffabdc45 ab958fd99b07
children 7ec8fea061b9
line wrap: on
line diff
--- a/Framework/Radiography/RadiographyDicomLayer.cpp	Fri Nov 29 21:22:21 2019 +0100
+++ b/Framework/Radiography/RadiographyDicomLayer.cpp	Fri Nov 29 21:24:29 2019 +0100
@@ -162,14 +162,18 @@
       Orthanc::ImageAccessor cropped;
       converted_->GetRegion(cropped, cropX, cropY, cropWidth, cropHeight);
 
+      unsigned int x1, y1, x2, y2;
+      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(buffer, cropped, interpolation, false);
-      unsigned int x1, y1, x2, y2;
-      OrthancStone::GetProjectiveTransformExtent(x1, y1, x2, y2,
-                                                 t.GetHomogeneousMatrix(),
-                                                 cropped.GetWidth(),
-                                                 cropped.GetHeight(),
-                                                 buffer.GetWidth(),
-                                                 buffer.GetHeight());
 
       if (applyWindowing)
       {