]> Creatis software - clitk.git/blob - common/clitkFilterBase.cxx
now dump anatomical info (carina position) into a DB
[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   VerboseWarningOffOn(); // OffOn, it's cool no ?
29   SetWarning("");
30   m_IsCancelled = false;
31 }
32 //--------------------------------------------------------------------
33
34
35 //--------------------------------------------------------------------
36 void clitk::FilterBase::SetWarning(std::string e)
37 {
38   m_Warning = e;
39   if (!GetVerboseWarningOff()) {
40     std::cout << GetWarning() << std::endl;
41   }
42 }
43 //--------------------------------------------------------------------
44
45
46 //--------------------------------------------------------------------
47 void clitk::FilterBase::StartNewStep(std::string s) 
48 {
49   if (Cancelled()) {
50     throw clitk::ExceptionObject("Filter is canceled.");
51   }
52
53   m_CurrentStepNumber++;
54   if (GetCurrentStepBaseId() != "") {
55     std::ostringstream oss;
56     oss << GetCurrentStepBaseId() << "." << m_CurrentStepNumber;
57     SetCurrentStepId(oss.str());
58   }
59   else {
60     std::ostringstream oss;
61     oss << m_CurrentStepNumber;
62     SetCurrentStepId(oss.str());
63   }
64
65   m_CurrentStepName = "Step "+GetCurrentStepId()+" -- "+s;
66   if (m_VerboseStep) {
67     std::cout << m_CurrentStepName << std::endl;
68     //"Step " << GetCurrentStepId() << " -- " << s << std::endl;
69   }
70 }
71 //--------------------------------------------------------------------
72
73
74 //--------------------------------------------------------------------
75 void clitk::FilterBase::StopCurrentStep() 
76 {
77   
78 }
79 //--------------------------------------------------------------------
80
81
82 //--------------------------------------------------------------------
83 void clitk::FilterBase::Cancel()
84 {
85   m_IsCancelled = true;
86 }
87 //--------------------------------------------------------------------
88
89
90 //--------------------------------------------------------------------
91  bool clitk::FilterBase::Cancelled()
92  {
93    return m_IsCancelled;
94  }
95 //--------------------------------------------------------------------
96