]> Creatis software - clitk.git/blob - tools/clitkImageArithmGenericFilter.h
GateAsciiImageIO is now cross-platform using itksys::RegularExpression
[clitk.git] / tools / clitkImageArithmGenericFilter.h
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 CLITKIMAGEARITHMGENERICFILTER_H
19 #define CLITKIMAGEARITHMGENERICFILTER_H
20 /**
21  -------------------------------------------------------------------
22  * @file   clitkImageArithmGenericFilter.h
23  * @author David Sarrut <David.Sarrut@creatis.insa-lyon.fr>
24  * @date   23 Feb 2008 08:37:53
25
26  * @brief  
27  -------------------------------------------------------------------*/
28
29 // clitk include
30 #include "clitkCommon.h"
31 #include "clitkImageToImageGenericFilter.h"
32
33 // itk include
34 #include "itkImage.h"
35 #include "itkImageIOBase.h"
36 #include "itkImageRegionIterator.h"
37 #include "itkImageRegionConstIterator.h"
38
39 //--------------------------------------------------------------------
40 namespace clitk {
41   
42   template<class args_info_type>
43   class ITK_EXPORT ImageArithmGenericFilter:
44     public clitk::ImageToImageGenericFilter<ImageArithmGenericFilter<args_info_type> > {
45     
46   public:
47         
48     // Constructor 
49     ImageArithmGenericFilter ();
50
51     // Types
52     typedef ImageArithmGenericFilter        Self;
53     typedef ImageToImageGenericFilterBase   Superclass;
54     typedef itk::SmartPointer<Self>         Pointer;
55     typedef itk::SmartPointer<const Self>   ConstPointer;
56
57     // New
58     itkNewMacro(Self);
59     
60     //--------------------------------------------------------------------
61     void SetArgsInfo(const args_info_type & a);
62
63     // Set methods
64     void SetDefaultPixelValue (double value) {  mDefaultPixelValue = value ;}
65     void SetTypeOfOperation (int value) {  mTypeOfOperation = value ;}
66     void SetScalar (double value) {  mScalar = value ;}
67     void EnableOverwriteInputImage(bool b);
68
69     // Get methods
70     double GetDefaultPixelValue () { return  mDefaultPixelValue ;} 
71     int GetTypeOfOperation () { return  mTypeOfOperation ;} 
72     double GetScalar () { return  mScalar ;} 
73
74     //--------------------------------------------------------------------
75     // Main function called each time the filter is updated
76     template<class InputImageType>  
77     void UpdateWithInputImageType();
78
79   protected:  
80     template<unsigned int Dim> void InitializeImageType();
81     bool mIsOperationUseASecondImage;
82     double mScalar;
83     double mDefaultPixelValue;
84     int mTypeOfOperation;  
85     args_info_type mArgsInfo;
86     bool mOverwriteInputImage;
87     bool mOutputIsFloat;
88     
89     template<class Iter1, class Iter2>
90       void ComputeImage(Iter1 it, Iter2 ito);
91
92     template<class Iter1, class Iter2, class Iter3>
93       void ComputeImage(Iter1 it1, Iter2 it2, Iter3 ito);
94
95     //--------------------------------------------------------------------
96
97   }; // end class ImageArithmGenericFilter
98 } // end namespace
99 //--------------------------------------------------------------------
100
101 #ifndef ITK_MANUAL_INSTANTIATION
102 #include "clitkImageArithmGenericFilter.txx"
103 #endif
104
105 #endif //#define CLITKIMAGEARITHMGENERICFILTER_H
106