diff Framework/Radiography/RadiographyDicomLayer.cpp @ 1201:ab958fd99b07

RadiographyScene fixes
author Alain Mazy <alain@mazy.be>
date Fri, 29 Nov 2019 16:21:24 +0100
parents a5f2a6b04a31
children b519c1c878f1 a989c7d46b9a
line wrap: on
line diff
--- a/Framework/Radiography/RadiographyDicomLayer.cpp	Thu Nov 28 18:28:15 2019 +0100
+++ b/Framework/Radiography/RadiographyDicomLayer.cpp	Fri Nov 29 16:21:24 2019 +0100
@@ -161,14 +161,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)
       {