]> Creatis software - clitk.git/blob - tools/clitkVectorArithmGenericFilter.h
close #59 #58 Change clitkAffineTransform --transform_grid
[clitk.git] / tools / clitkVectorArithmGenericFilter.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 CLITKVectorArithmGENERICFILTER_H
19 #define CLITKVectorArithmGENERICFILTER_H
20 /**
21  -------------------------------------------------------------------
22  * @file   clitkVectorArithmGenericFilter.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 #include "clitkVectorArithm_ggo.h"
33
34 // itk include
35 #include "itkImage.h"
36 #include "itkImageIOBase.h"
37 #include "itkImageRegionIterator.h"
38 #include "itkImageRegionConstIterator.h"
39
40 //--------------------------------------------------------------------
41 namespace clitk {
42   
43   template<class args_info_type>
44   class ITK_EXPORT VectorArithmGenericFilter:
45     public clitk::ImageToImageGenericFilter<VectorArithmGenericFilter<args_info_type> > {
46     
47   public:
48         
49     // Constructor 
50     VectorArithmGenericFilter ();
51
52     // Types
53     typedef VectorArithmGenericFilter        Self;
54     typedef ImageToImageGenericFilterBase   Superclass;
55     typedef itk::SmartPointer<Self>         Pointer;
56     typedef itk::SmartPointer<const Self>   ConstPointer;
57
58     // New
59     itkNewMacro(Self);
60     
61     //--------------------------------------------------------------------
62     void SetArgsInfo(const args_info_type & a);
63
64     // Set methods
65     void SetDefaultPixelValue (double value) {  mDefaultPixelValue = value ;}
66     void SetTypeOfOperation (int value) {  mTypeOfOperation = value ;}
67     void SetScalar (double value) {  mScalar = value ;}
68     void EnableOverwriteInputImage(bool b);
69
70     // Get methods
71     double GetDefaultPixelValue () { return  mDefaultPixelValue ;} 
72     int GetTypeOfOperation () { return  mTypeOfOperation ;} 
73     double GetScalar () { return  mScalar ;} 
74
75     //--------------------------------------------------------------------
76     // Main function called each time the filter is updated
77     template<class InputImageType>  
78     void UpdateWithInputImageType();
79
80   protected:  
81     template<unsigned int Dim> void InitializeImageType();
82     bool mIsOperationUseASecondImage;
83     double mScalar;
84     double mDefaultPixelValue;
85     int mTypeOfOperation;  
86     args_info_type mArgsInfo;
87     bool mOverwriteInputImage;
88     bool mOutputIsFloat;
89     bool mIsOutputScalar;
90     
91     template<class Iter1, class Iter2>
92       void ComputeImage(Iter1 it, Iter2 ito);
93
94     template<class Iter1, class Iter2, class Iter3>
95       void ComputeImage(Iter1 it1, Iter2 it2, Iter3 ito);
96     
97     template<class Iter1, class Iter2>
98       void ComputeScalarImage(Iter1 it, Iter2 ito);
99
100     template<class Iter1, class Iter2, class Iter3>
101       void ComputeScalarImage(Iter1 it1, Iter2 it2, Iter3 ito);
102
103     //--------------------------------------------------------------------
104
105   }; // end class VectorArithmGenericFilter
106
107   // specializations for itk::Vector<float, 3u>, 3u
108 } // end namespace
109 //--------------------------------------------------------------------
110
111   
112 #ifndef ITK_MANUAL_INSTANTIATION
113 #include "clitkVectorArithmGenericFilter.txx"
114 #endif
115
116 #endif //#define CLITKVectorArithmGENERICFILTER_H
117