]> Creatis software - clitk.git/blob - tools/clitkImageArithmGenericFilter.h
Add preserve studyUID in clitkImage2Dicom
[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 #include "clitkImageArithm_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 ImageArithmGenericFilter:
45     public clitk::ImageToImageGenericFilter<ImageArithmGenericFilter<args_info_type> > {
46     
47   public:
48         
49     // Constructor 
50     ImageArithmGenericFilter ();
51
52     // Types
53     typedef ImageArithmGenericFilter        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     
90     template<class Iter1, class Iter2>
91       void ComputeImage(Iter1 it, Iter2 ito);
92
93     template<class Iter1, class Iter2, class Iter3>
94       void ComputeImage(Iter1 it1, Iter2 it2, Iter3 ito);
95
96     //--------------------------------------------------------------------
97
98   }; // end class ImageArithmGenericFilter
99
100 } // end namespace
101 //--------------------------------------------------------------------
102
103   
104 #ifndef ITK_MANUAL_INSTANTIATION
105 #include "clitkImageArithmGenericFilter.txx"
106 #endif
107
108 #endif //#define CLITKIMAGEARITHMGENERICFILTER_H
109