X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=tools%2FclitkImageArithmGenericFilter.txx;h=37fa000d3c3e402a1dac421696e070ed8f4f4e90;hb=33c594d9f55d2b377223fc989727d42114170c77;hp=8efd6a7dfcabefe54f2e750b7f58ea91637ed8a3;hpb=efba8919f9e2fb300f82d5bd2cafe70a0f7cffd1;p=clitk.git diff --git a/tools/clitkImageArithmGenericFilter.txx b/tools/clitkImageArithmGenericFilter.txx index 8efd6a7..37fa000 100644 --- a/tools/clitkImageArithmGenericFilter.txx +++ b/tools/clitkImageArithmGenericFilter.txx @@ -45,7 +45,6 @@ template void ImageArithmGenericFilter::InitializeImageType() { ADD_DEFAULT_IMAGE_TYPES(Dim); - ADD_VEC_IMAGE_TYPE(3u,3u,float); } //-------------------------------------------------------------------- @@ -66,7 +65,7 @@ void ImageArithmGenericFilter::SetArgsInfo(const args_info_type mArgsInfo=a; // Set value - SetIOVerbose(mArgsInfo.verbose_flag); + this->SetIOVerbose(mArgsInfo.verbose_flag); mTypeOfOperation = mArgsInfo.operation_arg; mDefaultPixelValue = mArgsInfo.pixelValue_arg; mScalar = mArgsInfo.scalar_arg; @@ -74,13 +73,13 @@ void ImageArithmGenericFilter::SetArgsInfo(const args_info_type if (mArgsInfo.imagetypes_flag) this->PrintAvailableImageTypes(); - if (mArgsInfo.input1_given) AddInputFilename(mArgsInfo.input1_arg); + if (mArgsInfo.input1_given) this->AddInputFilename(mArgsInfo.input1_arg); if (mArgsInfo.input2_given) { mIsOperationUseASecondImage = true; - AddInputFilename(mArgsInfo.input2_arg); + this->AddInputFilename(mArgsInfo.input2_arg); } - if (mArgsInfo.output_given) SetOutputFilename(mArgsInfo.output_arg); + if (mArgsInfo.output_given) this->SetOutputFilename(mArgsInfo.output_arg); // Check type of operation (with scalar or with other image) if ((mArgsInfo.input2_given) && (mArgsInfo.scalar_given)) { @@ -392,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);