]> Creatis software - clitk.git/blob - segmentation/clitkFillMaskGenericFilter.cxx
GateAsciiImageIO is now cross-platform using itksys::RegularExpression
[clitk.git] / segmentation / clitkFillMaskGenericFilter.cxx
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to:
5   - University of LYON              http://www.universite-lyon.fr/
6   - Léon Bérard cancer center       http://www.centreleonberard.fr
7   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
8
9   This software is distributed WITHOUT ANY WARRANTY; without even
10   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11   PURPOSE.  See the copyright notices for more information.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================*/
18 #ifndef clitkFillMaskGenericFilter_cxx
19 #define clitkFillMaskGenericFilter_cxx
20
21 /* =================================================
22  * @file   clitkFillMaskGenericFilter.cxx
23  * @author 
24  * @date   
25  * 
26  * @brief 
27  * 
28  ===================================================*/
29
30 #include "clitkFillMaskGenericFilter.h"
31
32
33 namespace clitk
34 {
35
36
37   //-----------------------------------------------------------
38   // Constructor
39   //-----------------------------------------------------------
40   FillMaskGenericFilter::FillMaskGenericFilter()
41   {
42     m_Verbose=false;
43     m_InputFileName="";
44   }
45
46
47   //-----------------------------------------------------------
48   // Update
49   //-----------------------------------------------------------
50   void FillMaskGenericFilter::Update()
51   {
52     // Read the Dimension and PixelType
53     int Dimension;
54     std::string PixelType;
55     ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType);
56
57     
58     // Call UpdateWithPixelType
59      if (m_Verbose) std::cout << "Image was detected to be "<<Dimension<<"D and "<< PixelType<<"..."<<std::endl;
60      if (Dimension != 3) 
61        {
62          std::cerr<<"Error: Only for 3D!!"<<std::endl;
63          return;
64        }
65      
66      if(PixelType == "short"){  
67        if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed short..." << std::endl;
68        UpdateWithPixelType<signed short>(); 
69      }
70      
71      //    else if(PixelType == "unsigned_short"){  
72      //       if (m_Verbose) std::cout  << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl;
73      //       UpdateWithPixelType<unsigned short>(); 
74      //     }
75      
76      else if (PixelType == "unsigned_char"){ 
77        if (m_Verbose) std::cout  << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl;
78        UpdateWithPixelType<unsigned char>();
79      }
80      
81      //     else if (PixelType == "char"){ 
82      //       if (m_Verbose) std::cout  << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl;
83      //       UpdateWithPixelType<signed char>();
84      //     }
85      
86      else {
87        if (m_Verbose) std::cout  << "Launching filter in "<< Dimension <<"D and float..." << std::endl;
88        UpdateWithPixelType<float>();
89      }
90   }
91
92
93 } //end clitk
94
95 #endif  //#define clitkFillMaskGenericFilter_cxx