From: srit Date: Tue, 15 Mar 2011 15:37:39 +0000 (+0000) Subject: Return nan when quering scalar value outside whole extent X-Git-Tag: v1.2.0~168 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=e34a7746ec0b9f82124e344edc79e348bb0278d2;p=clitk.git Return nan when quering scalar value outside whole extent --- 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);