]> Creatis software - clitk.git/blobdiff - tools/clitkMergeSequenceGenericFilter.txx
Add pixel type options for clitkMergeSequence (double and unsigned char)
[clitk.git] / tools / clitkMergeSequenceGenericFilter.txx
index 9eac7011ae2c944eb52940533085d509d810d9fa..7a57030dc9a1f2bd24a23fda079969a406a0776a 100644 (file)
@@ -28,43 +28,33 @@ namespace clitk
 
     if (m_Verbose) std::cout << "Image was detected to be "<<Dimension<<"D and "<<Components<<" component(s) of "<<  PixelType<<"..."<<std::endl;
 
-    if (Components==1)
-      {
-       if(PixelType == "short"){  
-         if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed short..." << std::endl;
-         UpdateWithDimAndPixelType<Dimension, signed 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>(); 
-       //     }
-       
-       else if (PixelType == "unsigned_char"){ 
-         if (m_Verbose) std::cout  << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl;
-         UpdateWithDimAndPixelType<Dimension, unsigned char>();
-       }
-       
-       //     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 (m_Verbose) std::cout  << "Launching filter in "<< Dimension <<"D and float..." << std::endl;
-         UpdateWithDimAndPixelType<Dimension, float>();
-       }
-      }
-
-    else if (Components==3)
-      {
-       if (m_Verbose) std::cout  << "Launching filter in "<< Dimension <<"D and 3D float (DVF)" << std::endl;
-       UpdateWithDimAndPixelType<Dimension, itk::Vector<float, 3> >();
+    if (Components==1) {
+      if(PixelType == "short") {
+        if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed short..." << std::endl;
+        UpdateWithDimAndPixelType<Dimension, signed 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>();
+      } else if (PixelType == "unsigned_char") {
+        if (m_Verbose) std::cout  << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl;
+        UpdateWithDimAndPixelType<Dimension, unsigned char>();
+      } 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>();
+      } else {
+        if (m_Verbose) std::cout  << "Launching filter in "<< Dimension <<"D and float..." << std::endl;
+        UpdateWithDimAndPixelType<Dimension, float>();
       }
+    } else if (Components==3) {
+      if (m_Verbose) std::cout  << "Launching filter in "<< Dimension <<"D and 3D float (DVF)" << std::endl;
+      UpdateWithDimAndPixelType<Dimension, itk::Vector<float, 3> >();
+    } else std::cerr<<"Number of components is "<<Components<<", not supported!"<<std::endl;
+  }
 
-    else std::cerr<<"Number of components is "<<Components<<", not supported!"<<std::endl;
 
-  }
-  
-  
   template<unsigned int Dimension, class PixelType >
   void MergeSequenceGenericFilter::UpdateWithDimAndPixelType()
   {
@@ -72,14 +62,14 @@ namespace clitk
     //Define the input and output image type
     typedef itk::Image<PixelType, Dimension> InputImageType;
     typedef itk::Image<PixelType, Dimension+1> OutputImageType;
-    
+
     //Read the input image series
     typedef itk::ImageSeriesReader<OutputImageType> ImageReaderType;
     typename  ImageReaderType::Pointer reader= ImageReaderType::New();
     reader->SetFileNames(m_InputNames);
     reader->Update();
     typename OutputImageType::Pointer image =reader->GetOutput();
+
     //Set the spacing
     typename OutputImageType::SpacingType spacing=image->GetSpacing();
     spacing[Dimension]=m_Spacing;