From: gueth Date: Thu, 3 Mar 2011 15:03:30 +0000 (+0000) Subject: uncertainty=100% when no dose in voxel (as in Gate) X-Git-Tag: v1.4.0~164^2~10 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=9bc860837c4d4ce325fe9fb0164c07d727ab572c;p=clitk.git uncertainty=100% when no dose in voxel (as in Gate) --- diff --git a/tests_dav/clitkImageUncertainty.cxx b/tests_dav/clitkImageUncertainty.cxx index b01d1f0..6fc003b 100644 --- a/tests_dav/clitkImageUncertainty.cxx +++ b/tests_dav/clitkImageUncertainty.cxx @@ -3,8 +3,8 @@ Program: clitk Module: $RCSfile: clitkImageUncertainty.cxx,v $ Language: C++ - Date: $Date: 2010/03/09 15:45:20 $ - Version: $Revision: 1.2 $ + Date: $Date: 2011/03/03 15:03:30 $ + Version: $Revision: 1.3 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -33,11 +33,14 @@ // clitk include #include "clitkImageUncertainty_ggo.h" #include "clitkImageCommon.h" +#include "clitkCommon.h" // itk include #include "itkImageRegionConstIterator.h" #include "itkImageRegionIterator.h" +#include // for isfinite + //==================================================================== int main(int argc, char * argv[]) { @@ -75,8 +78,9 @@ int main(int argc, char * argv[]) { while ( !pi.IsAtEnd() ) { double squared = pii.Get(); double mean = pi.Get(); - po.Set( sqrt((NumberOfEvents*squared - mean*mean) / - ((NumberOfEvents-1)*(mean*mean)) ) ); + double uncert = sqrt((NumberOfEvents*squared - mean*mean) / ((NumberOfEvents-1)*(mean*mean))); + if (!std::isnormal(uncert)) uncert = 1.; + po.Set(uncert); ++pi; ++pii; ++po;