From: tbaudier Date: Thu, 11 Jan 2018 08:58:01 +0000 (+0100) Subject: Debug default value when dividing by 0 in clitkImageArithm X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=5d27ea238f9a92605b0834bf5758b1d404026da5;p=clitk.git Debug default value when dividing by 0 in clitkImageArithm --- diff --git a/tools/clitkImageArithmGenericFilter.txx b/tools/clitkImageArithmGenericFilter.txx index 37fa000..da3d878 100644 --- a/tools/clitkImageArithmGenericFilter.txx +++ b/tools/clitkImageArithmGenericFilter.txx @@ -218,7 +218,7 @@ void ImageArithmGenericFilter::ComputeImage(Iter1 it1, Iter2 it break; case 2: // Divide while (!ito.IsAtEnd()) { - if (it1.Get() != 0) + if (it2.Get() != 0) ito.Set(PixelTypeDownCast((double)it1.Get() / (double)it2.Get())); else ito.Set(mDefaultPixelValue); ++it1; @@ -269,7 +269,7 @@ void ImageArithmGenericFilter::ComputeImage(Iter1 it1, Iter2 it case 8: // Relative Difference while (!ito.IsAtEnd()) { if (it1.Get() != 0) ito.Set(PixelTypeDownCast(((double)it1.Get()-(double)it2.Get()))/(double)it1.Get()); - else ito.Set(0.0); + else ito.Set(mDefaultPixelValue); ++it1; ++it2; ++ito;