]> Creatis software - clitk.git/blob - itk/clitkReconstructThroughDilationImageFilter.h
Merge branch 'master' into PacsConnection
[clitk.git] / itk / clitkReconstructThroughDilationImageFilter.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 clitkReconstructThroughDilationImageFilter_h
19 #define clitkReconstructThroughDilationImageFilter_h
20
21 /* =================================================
22  * @file   clitkReconstructThroughDilationImageFilter.h
23  * @author 
24  * @date   
25  * 
26  * @brief 
27  * 
28  ===================================================*/
29
30
31 // clitk include
32 #include "clitkIO.h"
33 #include "clitkCommon.h"
34 #include "clitkConditionalBinaryDilateImageFilter.h"
35
36 //itk include
37 #include "itkImageToImageFilter.h"
38 #include "itkBinaryBallStructuringElement.h"
39 #include "itkConnectedComponentImageFilter.h"
40 #include "itkStatisticsImageFilter.h"
41 #include "itkCastImageFilter.h"
42 #if ITK_VERSION_MAJOR >= 4
43   #include "itkTestingComparisonImageFilter.h"
44 #else
45   #include "itkDifferenceImageFilter.h"
46 #endif
47 #include "itkThresholdImageFilter.h"
48
49 namespace clitk 
50 {
51
52   template <class InputImageType, class OutputImageType>
53   class ITK_EXPORT ReconstructThroughDilationImageFilter :
54     public itk::ImageToImageFilter<InputImageType, OutputImageType>
55   {
56   public:
57     //----------------------------------------
58     // ITK
59     //----------------------------------------
60     typedef ReconstructThroughDilationImageFilter                                                 Self;
61     typedef itk::ImageToImageFilter<InputImageType, OutputImageType>  Superclass;
62     typedef itk::SmartPointer<Self>                                   Pointer;
63     typedef itk::SmartPointer<const Self>                             ConstPointer;
64    
65     // Method for creation through the object factory
66     itkNewMacro(Self);  
67
68     // Run-time type information (and related methods)
69     itkTypeMacro( ReconstructThroughDilationImageFilter, ImageToImageFilter );
70
71     /** Dimension of the domain space. */
72     itkStaticConstMacro(InputImageDimension, unsigned int, Superclass::InputImageDimension);
73     itkStaticConstMacro(OutputImageDimension, unsigned int, Superclass::OutputImageDimension);
74
75     //----------------------------------------
76     // Typedefs
77     //----------------------------------------
78     typedef typename OutputImageType::RegionType OutputImageRegionType;
79     typedef int InternalPixelType;
80     typedef typename InputImageType::PixelType InputPixelType;
81     typedef typename OutputImageType::PixelType OutputPixelType;
82     typedef typename InputImageType::SizeType SizeType;
83
84     //----------------------------------------
85     // Set & Get
86     //----------------------------------------    
87     itkBooleanMacro(Verbose);
88     itkSetMacro( Verbose, bool);
89     itkGetConstReferenceMacro( Verbose, bool);
90     void SetRadius ( const SizeType& s){ m_Radius=s; this->Modified();}
91     void SetRadius(const int r) { for(uint i=0; i<InputImageDimension; i++) m_Radius[i] = r; SetRadius(m_Radius); }
92     SizeType GetRadius(void){return m_Radius;}
93     itkSetMacro( ErosionPaddingValue, OutputPixelType);
94     itkGetConstMacro( ErosionPaddingValue, OutputPixelType)
95     itkSetMacro( MaximumNumberOfLabels, unsigned int);
96     itkGetConstMacro( MaximumNumberOfLabels, unsigned int);
97     itkSetMacro( BackgroundValue, InternalPixelType);
98     itkGetConstMacro( BackgroundValue, InternalPixelType);
99     itkSetMacro( ForegroundValue, InternalPixelType);
100     itkGetConstMacro( ForegroundValue, InternalPixelType);
101
102   protected:
103
104     //----------------------------------------  
105     // Constructor & Destructor
106     //----------------------------------------  
107     ReconstructThroughDilationImageFilter();
108     ~ReconstructThroughDilationImageFilter() {};
109
110     //----------------------------------------  
111     // Update
112     //----------------------------------------  
113     // Generate Data
114     void GenerateData(void);
115
116     //     // Threaded Generate Data
117     //     void BeforeThreadedGenerateData(void );
118     //     void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, int threadId );
119     //     void AfterThreadedGenerateData(void );
120     //     // Override defaults
121     //     virtual void GenerateInputRequestedRegion();
122     //     virtual void GenerateOutputInformation (void);
123     //     virtual void EnlargeOutputRequestedRegion(DataObject *data);
124     //     void AllocateOutputs();
125     //----------------------------------------  
126     // Data members
127     //----------------------------------------
128     bool m_Verbose;
129     InternalPixelType m_BackgroundValue;
130     InternalPixelType m_ForegroundValue;
131     unsigned int m_MaximumNumberOfLabels;
132     OutputPixelType m_ErosionPaddingValue;
133     SizeType m_Radius;
134
135   };
136
137
138 } // end namespace clitk
139
140 #ifndef ITK_MANUAL_INSTANTIATION
141 #include "clitkReconstructThroughDilationImageFilter.txx"
142 #endif
143
144 #endif // #define clitkReconstructThroughDilationImageFilter_h
145
146