X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=tools%2FclitkImageArithmGenericFilter.txx;h=da3d87838b705e58b7255226f9b50a800dff2cd5;hb=996c472dd4315215c25890d6b8a9b565413352f7;hp=1316fc145c7caf0a524a9a77f3cf9255498f2c90;hpb=9b9e0b969b87e4e5799436d503e9cde6ea551ca7;p=clitk.git diff --git a/tools/clitkImageArithmGenericFilter.txx b/tools/clitkImageArithmGenericFilter.txx index 1316fc1..da3d878 100644 --- a/tools/clitkImageArithmGenericFilter.txx +++ b/tools/clitkImageArithmGenericFilter.txx @@ -45,8 +45,6 @@ template void ImageArithmGenericFilter::InitializeImageType() { ADD_DEFAULT_IMAGE_TYPES(Dim); - ADD_VEC_IMAGE_TYPE(3u,3u,float); - ADD_VEC_IMAGE_TYPE(3u,3u,double); } //-------------------------------------------------------------------- @@ -220,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; @@ -271,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; @@ -393,6 +391,18 @@ void clitk::ImageArithmGenericFilter::ComputeImage(Iter1 it, Ite ++ito; } break; + case 13: // -ln I/I0 + while (!it.IsAtEnd()) { + if (it.Get() == 0) { // special case for fluence image with 0 value in a pixel -> consider 0.5 + ito.Set(-log(0.5 / mScalar) ); + } + else { + ito.Set(PixelTypeDownCast(-log((double)it.Get() / mScalar)) ); + } + ++it; + ++ito; + } + break; default: // error ? std::cerr << "ERROR : the operation number (" << mTypeOfOperation << ") is not known." << std::endl; exit(-1);