]> Creatis software - clitk.git/blobdiff - tools/clitkImageArithmGenericFilter.txx
FIX: cant pipe cout to cerr.
[clitk.git] / tools / clitkImageArithmGenericFilter.txx
index 1316fc145c7caf0a524a9a77f3cf9255498f2c90..37fa000d3c3e402a1dac421696e070ed8f4f4e90 100644 (file)
@@ -45,8 +45,6 @@ template<unsigned int Dim>
 void ImageArithmGenericFilter<args_info_type>::InitializeImageType()
 {
   ADD_DEFAULT_IMAGE_TYPES(Dim);
-  ADD_VEC_IMAGE_TYPE(3u,3u,float);
-  ADD_VEC_IMAGE_TYPE(3u,3u,double);
 }
 //--------------------------------------------------------------------
 
@@ -393,6 +391,18 @@ void clitk::ImageArithmGenericFilter<args_info_type>::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<double, PixelType>(-log((double)it.Get() / mScalar)) );
+      }
+      ++it;
+      ++ito;
+    }
+    break;
   default: // error ?
     std::cerr << "ERROR : the operation number (" << mTypeOfOperation << ") is not known." << std::endl;
     exit(-1);