]> Creatis software - clitk.git/blob - filters/clitkImageArithmGenericFilter.h
- new GF system
[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 "clitkImageCommon.h"
28 #include "clitkImageToImageGenericFilter.h"
29
30 // itk include
31 #include "itkImage.h"
32 #include "itkImageIOBase.h"
33 #include "itkImageRegionIterator.h"
34 #include "itkImageRegionConstIterator.h"
35
36 namespace clitk {
37   
38   //--------------------------------------------------------------------
39   // Main class for an Image Resample Generic Filter 
40   // (multiple dimensions, multiple pixel types)
41   class ImageArithmGenericFilter:
42   public clitk::ImageToImageGenericFilter<ImageArithmGenericFilter> {
43   
44   public:
45         
46     // Constructor 
47     ImageArithmGenericFilter ();
48
49     // Types
50     typedef ImageArithmGenericFilter      Self;
51     typedef ImageToImageGenericFilterBase     Superclass;
52     typedef itk::SmartPointer<Self>       Pointer;
53     typedef itk::SmartPointer<const Self> ConstPointer;
54
55     // New
56     itkNewMacro(Self);
57     
58     // Set methods
59     void SetDefaultPixelValue (double value) {  mDefaultPixelValue = value ;}
60     void SetTypeOfOperation (int value) {  mTypeOfOperation = value ;}
61     void SetScalar (double value) {  mScalar = value ;}
62
63     // Get methods
64     double GetDefaultPixelValue () { return  mDefaultPixelValue ;} 
65     int GetTypeOfOperation () { return  mTypeOfOperation ;} 
66     double GetScalar () { return  mScalar ;} 
67
68     //--------------------------------------------------------------------
69     // Main function called each time the filter is updated
70     template<class InputImageType>  
71     void UpdateWithInputImageType();
72
73   protected:  
74     template<unsigned int Dim> void InitializeImageType();
75     bool mIsOperationUseASecondImage;
76     double mScalar;
77     double mDefaultPixelValue;
78     int mTypeOfOperation;  
79
80     template<class ImageType>
81     typename ImageType::Pointer ComputeImage(typename ImageType::Pointer inputImage);
82
83     template<class ImageType1, class ImageType2>
84     typename ImageType1::Pointer
85     ComputeImage(typename ImageType1::Pointer inputImage1, 
86                  typename ImageType2::Pointer inputImage2);
87     //--------------------------------------------------------------------
88
89   }; // end class ImageArithmGenericFilter
90 //--------------------------------------------------------------------
91
92 //#include "clitkImageArithmGenericFilter.txx"
93
94 } // end namespace
95 //--------------------------------------------------------------------
96
97 #endif //#define CLITKIMAGEARITHMGENERICFILTER_H
98