]> Creatis software - clitk.git/blobdiff - vv/vvSlicer.cxx
Fixed compiling error by MSVC++
[clitk.git] / vv / vvSlicer.cxx
index 24a552b251486faffaf677ebf989f9174686c883..5a15a16a3188f218f031004cd0397f4f69a777da 100644 (file)
@@ -1214,6 +1214,14 @@ double vvSlicer::GetScalarComponentAsDouble(vtkImageData *image, int X, double Y
   ix = lrint(X);
   iy = lrint(Y);
   iz = lrint(Z);
+  if (ix < image->GetWholeExtent()[0] ||
+      ix > image->GetWholeExtent()[1] ||
+      iy < image->GetWholeExtent()[2] ||
+      iy > image->GetWholeExtent()[3] ||
+      iz < image->GetWholeExtent()[4] ||
+      iz > image->GetWholeExtent()[5] )
+    return sqrt(-1.);
+
   image->SetUpdateExtent(ix, ix, iy, iy, iz, iz);
   image->Update();
   return image->GetScalarComponentAsDouble(ix, iy, iz, component);