18 #ifndef __itkValuedRegionalExtremaImageFilter_txx
19 #define __itkValuedRegionalExtremaImageFilter_txx
23 #include "itkNumericTraits.h"
26 #include "itkConnectedComponentAlgorithm.h"
30 template <
class TInputImage,
class TOutputImage,
class TFunction1,
32 ValuedRegionalExtremaImageFilter<TInputImage, TOutputImage, TFunction1,
44 template <
class TInputImage,
class TOutputImage,
class TFunction1,
49 ::GenerateInputRequestedRegion()
52 Superclass::GenerateInputRequestedRegion();
61 input->SetRequestedRegion( input->GetLargestPossibleRegion() );
65 template <
class TInputImage,
class TOutputImage,
class TFunction1,
73 ->SetRequestedRegion( this->GetOutput()->GetLargestPossibleRegion() );
77 template<
class TInputImage,
class TOutputImage,
class TFunction1,
85 this->AllocateOutputs();
89 this->GetOutput()->GetRequestedRegion().GetNumberOfPixels()*2);
95 InputIterator inIt( this->GetInput(),
96 this->GetOutput()->GetRequestedRegion() );
97 OutputIterator outIt( this->GetOutput(),
98 this->GetOutput()->GetRequestedRegion() );
100 outIt = outIt.Begin();
105 while ( !outIt.IsAtEnd() )
108 outIt.Set( static_cast<OutputImagePixelType>( currentValue ) );
109 if( currentValue != firstValue )
111 this->m_Flat =
false;
128 kernelRadius.Fill(1);
131 this->GetOutput()->GetRequestedRegion() );
136 this->GetOutput()->GetRequestedRegion() );
145 outNIt.OverrideBoundaryCondition(&oBC);
147 TFunction1 compareIn;
148 TFunction2 compareOut;
150 outIt = outIt.
Begin();
156 while ( !outIt.IsAtEnd() )
161 if (compareOut(V, m_MarkerValue))
173 if (compareIn(Adjacent, Cent))
189 outNIt += outIt.GetIndex() - outNIt.GetIndex();
194 IS.push(outNIt.GetIndex());
195 outNIt.SetCenterPixel(m_MarkerValue);
197 typename NOutputIterator::IndexListType::const_iterator LIt;
205 outNIt += idx - outNIt.GetIndex();
207 for (LIt = IndexList.begin(); LIt != IndexList.end(); ++LIt)
209 NVal = outNIt.GetPixel(*LIt);
213 IS.push(outNIt.GetIndex(*LIt));
216 outNIt.SetPixel(*LIt, m_MarkerValue);
232 template<
class TInputImage,
class TOutputImage,
class TFunction1,
237 ::PrintSelf(std::ostream &os,
Indent indent)
const
239 Superclass::PrintSelf(os, indent);
241 os << indent <<
"FullyConnected: " << m_FullyConnected << std::endl;
242 os << indent <<
"Flat: " << m_Flat << std::endl;
243 os << indent <<
"MarkerValue: " << m_MarkerValue << std::endl;