]> Creatis software - clitk.git/blobdiff - filters/clitkImageArithmGenericFilter.txx
Corrected bug: the image to image filter type was always displayed as available in...
[clitk.git] / filters / clitkImageArithmGenericFilter.txx
index 61aa066c61ce8a9aa329926840ddbec93a4c4894..9679d028e4ffa1cd5dd4f846954b79a2c999371d 100644 (file)
@@ -1,3 +1,20 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  Authors belong to: 
+  - University of LYON              http://www.universite-lyon.fr/
+  - Léon Bérard cancer center       http://oncora1.lyon.fnclcc.fr
+  - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+======================================================================-====*/
 #ifndef CLITKIMAGEARITHMGENERICFILTER_TXX
 #define CLITKIMAGEARITHMGENERICFILTER_TXX
 namespace clitk
@@ -20,10 +37,7 @@ namespace clitk
   template<class args_info_type>
   template<unsigned int Dim>
   void ImageArithmGenericFilter<args_info_type>::InitializeImageType() {      
-    ADD_IMAGE_TYPE(Dim, char);
-    ADD_IMAGE_TYPE(Dim, uchar);
-    ADD_IMAGE_TYPE(Dim, short);
-    ADD_IMAGE_TYPE(Dim, float);
+    ADD_DEFAULT_IMAGE_TYPES(Dim);
   }
   //--------------------------------------------------------------------
 
@@ -79,7 +93,6 @@ namespace clitk
   void ImageArithmGenericFilter<args_info_type>::UpdateWithInputImageType() {
     // Read input1
     typename ImageType::Pointer input1 = this->template GetInput<ImageType>(0);
-    typename ImageType::PixelType PixelType;
 
     // Set input image iterator
     typedef itk::ImageRegionIterator<ImageType> IteratorType;
@@ -97,7 +110,7 @@ namespace clitk
     }
 
     // Check if overwrite and outputisfloat and pixeltype is not float -> do not overwrite
-    if (mOverwriteInputImage && mOutputIsFloat && (typeid(PixelType) != typeid(float))) {
+    if (mOverwriteInputImage && mOutputIsFloat && (typeid(typename ImageType::PixelType) != typeid(float))) {
       // std::cerr << "Warning. Could not use both mOverwriteInputImage and mOutputIsFloat, because input is " 
       //                     << typeid(PixelType).name()
       //                     << std::endl;
@@ -193,7 +206,7 @@ namespace clitk
       break;
     case 5: // Absolute difference
       while (!ito.IsAtEnd()) {
-        ito.Set(PixelTypeDownCast<double, PixelType>(fabs(it2.Get()-it1.Get()))); 
+        ito.Set(PixelTypeDownCast<double, PixelType>(fabs((double)it2.Get()-(double)it1.Get()))); 
         ++it1; ++it2; ++ito;
       }
       break;