From e34a7746ec0b9f82124e344edc79e348bb0278d2 Mon Sep 17 00:00:00 2001 From: srit Date: Tue, 15 Mar 2011 15:37:39 +0000 Subject: [PATCH] Return nan when quering scalar value outside whole extent --- vv/vvSlicer.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vv/vvSlicer.cxx b/vv/vvSlicer.cxx index 24a552b..86824a2 100644 --- a/vv/vvSlicer.cxx +++ b/vv/vvSlicer.cxx @@ -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); -- 2.47.1