]> Creatis software - clitk.git/blob - filters/clitkImageArithmGenericFilter.h
ebe9c0b1e88ab76429f0cad3e144ed0e0272b774
[clitk.git] / filters / clitkImageArithmGenericFilter.h
1 /*-------------------------------------------------------------------------
2
3   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
4   l'Image). All rights reserved. See Doc/License.txt or
5   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
6                                                                                 
7      This software is distributed WITHOUT ANY WARRANTY; without even
8      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9      PURPOSE.  See the above copyright notices for more information.
10                                                                              
11 -------------------------------------------------------------------------*/
12
13 #ifndef CLITKIMAGEARITHMGENERICFILTER_H
14 #define CLITKIMAGEARITHMGENERICFILTER_H
15
16 /**
17  -------------------------------------------------------------------
18  * @file   clitkImageArithmGenericFilter.h
19  * @author David Sarrut <David.Sarrut@creatis.insa-lyon.fr>
20  * @date   23 Feb 2008 08:37:53
21
22  * @brief  
23  -------------------------------------------------------------------*/
24
25 // clitk include
26 #include "clitkCommon.h"
27 #include "clitkImageToImageGenericFilter.h"
28
29 // itk include
30 #include "itkImage.h"
31 #include "itkImageIOBase.h"
32 #include "itkImageRegionIterator.h"
33 #include "itkImageRegionConstIterator.h"
34
35 //--------------------------------------------------------------------
36 namespace clitk {
37   
38   template<class args_info_type>
39   class ITK_EXPORT ImageArithmGenericFilter:
40     public clitk::ImageToImageGenericFilter<ImageArithmGenericFilter<args_info_type> > {
41     
42   public:
43         
44     // Constructor 
45     ImageArithmGenericFilter ();
46
47     // Types
48     typedef ImageArithmGenericFilter        Self;
49     typedef ImageToImageGenericFilterBase   Superclass;
50     typedef itk::SmartPointer<Self>         Pointer;
51     typedef itk::SmartPointer<const Self>   ConstPointer;
52
53     // New
54     itkNewMacro(Self);
55     
56     //--------------------------------------------------------------------
57     void SetArgsInfo(const args_info_type & a);
58
59     // Set methods
60     void SetDefaultPixelValue (double value) {  mDefaultPixelValue = value ;}
61     void SetTypeOfOperation (int value) {  mTypeOfOperation = value ;}
62     void SetScalar (double value) {  mScalar = value ;}
63     void EnableOverwriteInputImage(bool b);
64
65     // Get methods
66     double GetDefaultPixelValue () { return  mDefaultPixelValue ;} 
67     int GetTypeOfOperation () { return  mTypeOfOperation ;} 
68     double GetScalar () { return  mScalar ;} 
69
70     //--------------------------------------------------------------------
71     // Main function called each time the filter is updated
72     template<class InputImageType>  
73     void UpdateWithInputImageType();
74
75   protected:  
76     template<unsigned int Dim> void InitializeImageType();
77     bool mIsOperationUseASecondImage;
78     double mScalar;
79     double mDefaultPixelValue;
80     int mTypeOfOperation;  
81     args_info_type mArgsInfo;
82     bool mOverwriteInputImage;
83     bool mOutputIsFloat;
84     
85     template<class Iter1, class Iter2>
86       void ComputeImage(Iter1 it, Iter2 ito);
87
88     template<class Iter1, class Iter2, class Iter3>
89       void ComputeImage(Iter1 it1, Iter2 it2, Iter3 ito);
90
91     //--------------------------------------------------------------------
92
93   }; // end class ImageArithmGenericFilter
94 } // end namespace
95 //--------------------------------------------------------------------
96
97 #ifndef ITK_MANUAL_INSTANTIATION
98 #include "clitkImageArithmGenericFilter.txx"
99 #endif
100
101 #endif //#define CLITKIMAGEARITHMGENERICFILTER_H
102