]> Creatis software - clitk.git/blobdiff - tools/clitkImageStatisticsGenericFilter.txx
Refactor cluster_tools CMakeLists
[clitk.git] / tools / clitkImageStatisticsGenericFilter.txx
index 81f93be1105ff3b162aee89c57530e0f1895744b..f5c82356dff35c50bd2a3c841d9dc07ae820bdea 100644 (file)
@@ -41,20 +41,20 @@ namespace clitk
       if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed short..." << std::endl;
       UpdateWithDimAndPixelType<Dimension, signed short, Components>(); 
     }
-    //    else if(PixelType == "unsigned_short"){  
-    //       if (m_Verbose) std::cout  << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl;
-    //       UpdateWithDimAndPixelType<Dimension, unsigned short>(); 
-    //     }
+    else if(PixelType == "unsigned_short"){  
+      if (m_Verbose) std::cout  << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl;
+      UpdateWithDimAndPixelType<Dimension, unsigned short, Components>(); 
+    }
     
     else if (PixelType == "unsigned_char"){ 
       if (m_Verbose) std::cout  << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl;
       UpdateWithDimAndPixelType<Dimension, unsigned char, Components>();
     }
-    
-    //     else if (PixelType == "char"){ 
-    //       if (m_Verbose) std::cout  << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl;
-    //       UpdateWithDimAndPixelType<Dimension, signed char>();
-    //     }
+        
+    else if(PixelType == "double"){  
+      if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and double..." << std::endl;
+      UpdateWithDimAndPixelType<Dimension, double, Components>(); 
+    }
     else {
       if (m_Verbose) std::cout  << "Launching filter in "<< Dimension <<"D and float..." << std::endl;
       UpdateWithDimAndPixelType<Dimension, float, Components>();
@@ -140,12 +140,19 @@ namespace clitk
             typename ResamplerType::Pointer resampler = ResamplerType::New();
             resampler->SetInput(labelImage);
             resampler->SetOutputSpacing(input->GetSpacing());
+            resampler->SetGaussianFilteringEnabled(false);
             resampler->Update();
             labelImage = resampler->GetOutput();
+            //writeImage<LabelImageType>(labelImage, "test1.mha");
+            
+            typedef clitk::CropLikeImageFilter<LabelImageType> FilterType;
+            typename FilterType::Pointer crop = FilterType::New();
+            crop->SetInput(labelImage);
+            crop->SetCropLikeImage(input);
+            crop->Update();
+            labelImage = crop->GetOutput();                        
+            //writeImage<LabelImageType>(labelImage, "test2.mha");
 
-            typename itk::ImageBase<LabelImageType::ImageDimension>::RegionType reg 
-              = input->GetLargestPossibleRegion();
-            labelImage = ResizeImageLike<LabelImageType>(labelImage, &reg, 0);
           }
           else {
             std::cerr << "Mask image has a different size/spacing than input. Abort" << std::endl;