]> Creatis software - clitk.git/blob - common/clitkFilterBase.txx
filter base (trial)
[clitk.git] / common / clitkFilterBase.txx
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 #include "clitkImageCommon.h"
20
21 //--------------------------------------------------------------------
22 template<class OptionType>
23 void clitk::FilterBase::VerboseOption(std::string name, OptionType value) 
24 {
25   if (!this->GetVerboseOption()) return;
26   std::cout << "Set option '" << name << "' = " << value << std::endl;
27 }
28 //--------------------------------------------------------------------
29
30
31 //--------------------------------------------------------------------
32 template<class OptionType>
33 void clitk::FilterBase::VerboseOption(std::string name, int nb, OptionType value) 
34 {
35   if (!this->GetVerboseOption()) return;
36   if (nb==0) std::cout << "Set option '" << name << "' not given" << std::endl;
37   else {
38     std::cout << "Set option '" << name << "' = " << value << std::endl;
39   }
40 }
41 //--------------------------------------------------------------------
42
43
44 //--------------------------------------------------------------------
45 template<class OptionType>
46 void clitk::FilterBase::VerboseOptionV(std::string name, int nb, OptionType * value) 
47 {
48   if (!this->GetVerboseOption()) return;
49   if (nb==0) std::cout << "Set option '" << name << "' not given" << std::endl;
50   else {
51     std::cout << "Set option '" << name << "'[" << nb << "] ";
52     for(int i=0; i<nb; i++) std::cout << value[i] << " ";
53     std::cout << std::endl;
54   }
55 }
56 //--------------------------------------------------------------------
57
58
59 //--------------------------------------------------------------------
60 template<class TInternalImageType>
61 void clitk::FilterBase::StopCurrentStep(typename TInternalImageType::Pointer p) 
62 {
63   if (m_WriteStep) {
64     std::ostringstream name;
65     name << "step-" << GetCurrentStepId() << ".mhd";
66     clitk::writeImage<TInternalImageType>(p, name.str());
67   }
68 }
69 //--------------------------------------------------------------------
70
71