]> Creatis software - FrontAlgorithms.git/blob - libs/fpa/Image/MoriFilter.hxx
6c749c65b0289cd7ba90d76fa10a1d1055783e24
[FrontAlgorithms.git] / libs / fpa / Image / MoriFilter.hxx
1 #ifndef __fpa__Image__MoriFilter__hxx__
2 #define __fpa__Image__MoriFilter__hxx__
3
4 // -------------------------------------------------------------------------
5 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
6 typename
7 fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
8 TAuxImage*
9 fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
10 GetAuxiliaryImage( )
11 {
12   return( this->m_Helper->GetOutput( ) );
13 }
14
15 // -------------------------------------------------------------------------
16 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
17 const typename
18 fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
19 TAuxImage*
20 fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
21 GetAuxiliaryImage( ) const
22 {
23   return( this->m_Helper->GetOutput( ) );
24 }
25
26 // -------------------------------------------------------------------------
27 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
28 typename
29 fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
30 TInputPixel
31 fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
32 GetLower( ) const
33 {
34   return( this->m_Helper->GetLower( ) );
35 }
36
37 // -------------------------------------------------------------------------
38 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
39 typename
40 fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
41 TInputPixel
42 fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
43 GetUpper( ) const
44 {
45   return( this->m_Helper->GetUpper( ) );
46 }
47
48 // -------------------------------------------------------------------------
49 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
50 typename
51 fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
52 TInputPixel
53 fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
54 GetStep( ) const
55 {
56   return( this->m_Helper->GetStep( ) );
57 }
58
59 // -------------------------------------------------------------------------
60 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
61 typename
62 fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
63 TOutputPixel
64 fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
65 GetInsideValue( ) const
66 {
67   return( this->m_Threshold->GetInsideValue( ) );
68 }
69
70 // -------------------------------------------------------------------------
71 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
72 typename
73 fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
74 TOutputPixel
75 fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
76 GetOutsideValue( ) const
77 {
78   return( this->m_Threshold->GetInsideValue( ) );
79 }
80
81 // -------------------------------------------------------------------------
82 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
83 typename
84 fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
85 TOutputPixel
86 fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
87 GetOptimumThreshold( ) const
88 {
89   return( this->m_Helper->GetOptimumThreshold( ) );
90 }
91
92 // -------------------------------------------------------------------------
93 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
94 typename
95 fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
96 TCurve fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
97 GetCurve( ) const
98 {
99   return( this->m_Helper->GetCurve( ) );
100 }
101
102 // -------------------------------------------------------------------------
103 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
104 void fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
105 SetLower( const TInputPixel& v )
106 {
107   this->m_Helper->SetLower( v );
108   this->Modified( );
109 }
110
111 // -------------------------------------------------------------------------
112 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
113 void fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
114 SetUpper( const TInputPixel& v )
115 {
116   this->m_Helper->SetUpper( v );
117   this->Modified( );
118 }
119
120 // -------------------------------------------------------------------------
121 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
122 void fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
123 SetStep( const TInputPixel& v )
124 {
125   this->m_Helper->SetStep( v );
126   this->Modified( );
127 }
128
129 // -------------------------------------------------------------------------
130 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
131 void fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
132 SetThresholdRange(
133   const TInputPixel& l, const TInputPixel& u, const TInputPixel& s
134   )
135 {
136   this->SetLower( l );
137   this->SetUpper( u );
138   this->SetStep( s );
139 }
140
141 // -------------------------------------------------------------------------
142 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
143 void fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
144 SetInsideValue( const TOutputPixel& v )
145 {
146   this->m_Threshold->SetInsideValue( v );
147   this->Modified( );
148 }
149
150 // -------------------------------------------------------------------------
151 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
152 void fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
153 SetOutsideValue( const TOutputPixel& v )
154 {
155   this->m_Threshold->SetOutsideValue( v );
156   this->Modified( );
157 }
158
159 // -------------------------------------------------------------------------
160 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
161 fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
162 MoriFilter( )
163   : Superclass( )
164 {
165   this->m_Helper = THelper::New( );
166   this->m_Threshold = TThreshold::New( );
167 }
168
169 // -------------------------------------------------------------------------
170 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
171 fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
172 ~MoriFilter( )
173 {
174 }
175
176 // -------------------------------------------------------------------------
177 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
178 void fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
179 GenerateData( )
180 {
181   this->m_Helper->SetSeed( this->m_Seed );
182   this->m_Helper->SetInput( this->GetInput( ) );
183   this->m_Helper->Update( );
184
185   this->m_Threshold->SetInput( this->m_Helper->GetOutput( ) );
186   this->m_Threshold->SetLowerThreshold( std::numeric_limits< _TAuxPixel >::min( ) );
187   this->m_Threshold->SetUpperThreshold( this->m_Helper->GetOptimumThreshold( ) );
188   this->m_Threshold->Update( );
189   this->GetOutput( )->Graft( this->m_Threshold->GetOutput( ) );
190 }
191
192 #endif // __fpa__Image__MoriFilter__hxx__
193
194 // eof - $RCSfile$