]> Creatis software - clitk.git/blob - filters/clitkImageFillRegionGenericFilter.h
22e5fec3167145a7aaf44e72586cc7cfdf5caec2
[clitk.git] / filters / clitkImageFillRegionGenericFilter.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 CLITKIMAGEFILLREGIONGENERICFILTER_H
14 #define CLITKIMAGEFILLREGIONGENERICFILTER_H
15
16 /**
17  -------------------------------------------------------------------
18  * @file   clitkImageFillRegionGenericFilter.h
19  * @author David Sarrut <David.Sarrut@creatis.insa-lyon.fr>
20  * @date   23 Feb 2008
21  -------------------------------------------------------------------*/
22
23 // clitk include
24 #include "clitkCommon.h"
25 #include "clitkImageCommon.h"
26 #include "clitkImageToImageGenericFilter.h"
27
28 // itk include
29 #include "itkImage.h"
30 #include "itkImageIOBase.h"
31 #include "itkImageRegionIterator.h"
32 #include "itkImageRegionConstIterator.h"
33 #include "itkImageRegionIteratorWithIndex.h"
34
35 namespace clitk {
36   
37   //--------------------------------------------------------------------
38   class ImageFillRegionGenericFilter: 
39     public clitk::ImageToImageGenericFilter<ImageFillRegionGenericFilter> {
40   
41   public:
42         
43     // Constructor 
44     ImageFillRegionGenericFilter ();
45     ~ImageFillRegionGenericFilter (){;}
46
47     // Types
48     typedef ImageFillRegionGenericFilter  Self;
49     typedef itk::SmartPointer<Self>       Pointer;
50     typedef itk::SmartPointer<const Self> ConstPointer;
51
52     // New
53     itkNewMacro(Self);
54     
55     // Set methods
56     void SetFillPixelValue (double value) { mPixelValue = value; }
57     void SetRegion(int * size, int * start) { mSize = size; mStart = start ; }
58     void SetSphericRegion(std::vector<double> & radius, std::vector<double> & center);
59     void SetSphericRegion(std::vector<double> & radius);
60
61     //--------------------------------------------------------------------
62     // Main function called each time the filter is updated
63     template<class InputImageType>  
64     void UpdateWithInputImageType();
65
66   protected:  
67     template<unsigned int Dim> void InitializeImageType();
68     double mPixelValue;
69     int * mSize;
70     int * mStart;
71     std::vector<double> mCenter;
72     std::vector<double> mRadius;
73     bool mSphericRegion;
74     bool m_IsCentered;
75
76     template<unsigned int Dim, class PixelType> void Update_WithDimAndPixelType_SphericRegion();
77
78   }; // end class ImageFillRegionGenericFilter
79 //--------------------------------------------------------------------
80
81 #include "clitkImageFillRegionGenericFilter.txx"
82
83 } // end namespace
84 //--------------------------------------------------------------------
85
86 #endif //#define CLITKIMAGEFILLREGIONGENERICFILTER_H
87