17 #ifndef __itkConnectedThresholdImageFilter_txx
18 #define __itkConnectedThresholdImageFilter_txx
35 template <
class TInputImage,
class TOutputImage>
42 this->m_Connectivity = FaceConnectivity;
53 template <
class TInputImage,
class TOutputImage>
59 this->AddSeed ( seed );
62 template <
class TInputImage,
class TOutputImage>
67 this->m_SeedList.push_back ( seed );
71 template <
class TInputImage,
class TOutputImage>
76 if( m_SeedList.size() > 0 )
78 this->m_SeedList.clear();
86 template <
class TInputImage,
class TOutputImage>
91 this->Superclass::PrintSelf(os, indent);
92 os << indent <<
"Upper: "
95 os << indent <<
"Lower: "
98 os << indent <<
"ReplaceValue: "
101 os << indent <<
"Connectivity: " << m_Connectivity << std::endl;
104 template <
class TInputImage,
class TOutputImage>
109 Superclass::GenerateInputRequestedRegion();
110 if ( this->GetInput() )
114 image->SetRequestedRegionToLargestPossibleRegion();
118 template <
class TInputImage,
class TOutputImage>
123 Superclass::EnlargeOutputRequestedRegion(output);
127 template <
class TInputImage,
class TOutputImage>
132 if (input != this->GetLowerInput())
135 const_cast<InputPixelObjectType*>(input));
141 template <
class TInputImage,
class TOutputImage>
146 if (input != this->GetUpperInput())
149 const_cast<InputPixelObjectType*>(input));
154 template <
class TInputImage,
class TOutputImage>
161 if (upper && upper->Get() == threshold)
171 upper = InputPixelObjectType::New();
174 upper->Set(threshold);
179 template <
class TInputImage,
class TOutputImage>
186 if (lower && lower->Get() == threshold)
196 lower = InputPixelObjectType::New();
199 lower->Set(threshold);
204 template <
class TInputImage,
class TOutputImage>
215 lower = InputPixelObjectType::New();
224 template <
class TInputImage,
class TOutputImage>
235 upper = InputPixelObjectType::New();
244 template <
class TInputImage,
class TOutputImage>
250 =
const_cast<Self*
>(
this)->GetLowerInput();
255 template <
class TInputImage,
class TOutputImage>
261 =
const_cast<Self*
>(
this)->GetUpperInput();
266 template <
class TInputImage,
class TOutputImage>
277 m_Lower = lowerThreshold->Get();
278 m_Upper = upperThreshold->Get();
282 outputImage->SetBufferedRegion( region );
283 outputImage->Allocate();
288 typename FunctionType::Pointer
function = FunctionType::New();
289 function->SetInputImage ( inputImage );
290 function->ThresholdBetween ( m_Lower, m_Upper );
294 if (this->m_Connectivity == FaceConnectivity)
297 IteratorType it ( outputImage,
function, m_SeedList );
300 while( !it.IsAtEnd())
302 it.Set(m_ReplaceValue);
304 progress.CompletedPixel();
308 #ifdef ITK_USE_REVIEW
309 else if (this->m_Connectivity == FullConnectivity)
317 IteratorType it ( outputImage,
function, m_SeedList );
318 it.FullyConnectedOn();
321 while( !it.IsAtEnd())
323 it.Set(m_ReplaceValue);
325 progress.CompletedPixel();