]> Creatis software - clitk.git/blob - common/clitkFilterBase.cxx
change GetScalarTypeAsString to GetScalarTypeAsITKString to make explicit that type...
[clitk.git] / common / clitkFilterBase.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://oncora1.lyon.fnclcc.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
19 // clitk
20 #include "clitkFilterBase.h"
21
22 //--------------------------------------------------------------------
23 clitk::FilterBase::FilterBase() 
24 {
25   SetVerboseOption(false);
26   SetCurrentStepNumber(0);
27   SetCurrentStepBaseId("");
28   StopOnErrorOn();
29   ResetLastError();
30   VerboseWarningOffOn(); // OffOn, it's cool not ?
31   SetWarning("");
32 }
33 //--------------------------------------------------------------------
34
35
36 //--------------------------------------------------------------------
37 void clitk::FilterBase::ResetLastError()
38 {
39   m_LastError = "";
40 }
41 //--------------------------------------------------------------------
42
43
44 //--------------------------------------------------------------------
45 void clitk::FilterBase::SetLastError(std::string e)
46 {
47   m_LastError = e;
48   if (GetStopOnError()) {
49     std::cerr << GetLastError() << std::endl;
50     exit(0);
51   }
52 }
53 //--------------------------------------------------------------------
54
55
56 //--------------------------------------------------------------------
57 void clitk::FilterBase::SetWarning(std::string e)
58 {
59   m_Warning = e;
60   if (!GetVerboseWarningOff()) {
61     std::cout << GetWarning() << std::endl;
62   }
63 }
64 //--------------------------------------------------------------------
65
66
67 //--------------------------------------------------------------------
68 void clitk::FilterBase::StartNewStep(std::string s) 
69 {
70   m_CurrentStepNumber++;
71   if (GetCurrentStepBaseId() != "") {
72     std::ostringstream oss;
73     oss << GetCurrentStepBaseId() << "." << m_CurrentStepNumber;
74     SetCurrentStepId(oss.str());
75   }
76   else {
77     std::ostringstream oss;
78     oss << m_CurrentStepNumber;
79     SetCurrentStepId(oss.str());
80   }
81
82   if (m_VerboseStep) {
83     std::cout << "Step " << GetCurrentStepId() << " -- " << s << std::endl;
84   }
85 }
86 //--------------------------------------------------------------------
87
88
89 //--------------------------------------------------------------------
90 void clitk::FilterBase::StopCurrentStep() 
91 {
92   
93 }
94 //--------------------------------------------------------------------
95