]> Creatis software - clitk.git/blob - segmentation/clitkFillMaskGenericFilter.cxx
59a88e59da3f78dfc166a95d3c499dbe4cb0cf8e
[clitk.git] / segmentation / clitkFillMaskGenericFilter.cxx
1 #ifndef clitkFillMaskGenericFilter_cxx
2 #define clitkFillMaskGenericFilter_cxx
3
4 /* =================================================
5  * @file   clitkFillMaskGenericFilter.cxx
6  * @author 
7  * @date   
8  * 
9  * @brief 
10  * 
11  ===================================================*/
12
13 #include "clitkFillMaskGenericFilter.h"
14
15
16 namespace clitk
17 {
18
19
20   //-----------------------------------------------------------
21   // Constructor
22   //-----------------------------------------------------------
23   FillMaskGenericFilter::FillMaskGenericFilter()
24   {
25     m_Verbose=false;
26     m_InputFileName="";
27   }
28
29
30   //-----------------------------------------------------------
31   // Update
32   //-----------------------------------------------------------
33   void FillMaskGenericFilter::Update()
34   {
35     // Read the Dimension and PixelType
36     int Dimension;
37     std::string PixelType;
38     ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType);
39
40     
41     // Call UpdateWithPixelType
42      if (m_Verbose) std::cout << "Image was detected to be "<<Dimension<<"D and "<< PixelType<<"..."<<std::endl;
43      if (Dimension != 3) 
44        {
45          std::cerr<<"Error: Only for 3D!!"<<std::endl;
46          return;
47        }
48      
49      if(PixelType == "short"){  
50        if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed short..." << std::endl;
51        UpdateWithPixelType<signed short>(); 
52      }
53      
54      //    else if(PixelType == "unsigned_short"){  
55      //       if (m_Verbose) std::cout  << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl;
56      //       UpdateWithPixelType<unsigned short>(); 
57      //     }
58      
59      else if (PixelType == "unsigned_char"){ 
60        if (m_Verbose) std::cout  << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl;
61        UpdateWithPixelType<unsigned char>();
62      }
63      
64      //     else if (PixelType == "char"){ 
65      //       if (m_Verbose) std::cout  << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl;
66      //       UpdateWithPixelType<signed char>();
67      //     }
68      
69      else {
70        if (m_Verbose) std::cout  << "Launching filter in "<< Dimension <<"D and float..." << std::endl;
71        UpdateWithPixelType<float>();
72      }
73   }
74
75
76 } //end clitk
77
78 #endif  //#define clitkFillMaskGenericFilter_cxx