X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=tools%2FclitkImageArithmGenericFilter.txx;h=37fa000d3c3e402a1dac421696e070ed8f4f4e90;hb=182d324aaea3d92e8b676d8a6e609ba8fab44726;hp=4c2f0a58c6ef1f32cf858ddb5a02cfef31c0a722;hpb=2e890f7bcf7118cd1b49ff824fa8b5b6a6d9f044;p=clitk.git diff --git a/tools/clitkImageArithmGenericFilter.txx b/tools/clitkImageArithmGenericFilter.txx index 4c2f0a5..37fa000 100644 --- a/tools/clitkImageArithmGenericFilter.txx +++ b/tools/clitkImageArithmGenericFilter.txx @@ -391,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);