18 #ifndef itkThresholdLabelerImageFilter_h
19 #define itkThresholdLabelerImageFilter_h
44 template<
typename TInput,
typename TOutput >
56 { m_Thresholds = thresholds; }
60 { m_LabelOffset = labelOffset; }
74 return !( *
this != other );
79 size_t size = m_Thresholds.size();
85 if ( A <= m_Thresholds[0] )
89 for (
size_t i = 0; i < size - 1; i++ )
92 if ( m_Thresholds[i] < A && A <= m_Thresholds[i + 1] )
94 return static_cast< TOutput
>( i + 1 ) + m_LabelOffset;
97 return static_cast< TOutput
>( size ) + m_LabelOffset;
107 template<
typename TInputImage,
typename TOutputImage >
111 Functor::ThresholdLabeler<
112 typename TInputImage::PixelType,
113 typename TOutputImage::PixelType > >
119 TInputImage, TOutputImage,
121 typename TInputImage::PixelType,
122 typename TOutputImage::PixelType >
144 #ifdef ITK_USE_CONCEPT_CHECKING
159 m_Thresholds = thresholds;
160 m_RealThresholds.clear();
161 typename ThresholdVector::const_iterator itr = m_Thresholds.begin();
162 while ( itr != m_Thresholds.end() )
164 m_RealThresholds.push_back( static_cast< RealThresholdType >( *itr ) );
173 {
return m_Thresholds; }
178 m_RealThresholds = thresholds;
179 m_Thresholds.clear();
180 typename RealThresholdVector::const_iterator itr = m_RealThresholds.begin();
181 while ( itr != m_RealThresholds.end() )
183 m_Thresholds.push_back( static_cast< InputPixelType >( *itr ) );
192 {
return m_RealThresholds; }
197 itkGetConstMacro(LabelOffset, OutputPixelType);
203 void PrintSelf(std::ostream & os,
Indent indent)
const ITK_OVERRIDE;
207 virtual void BeforeThreadedGenerateData() ITK_OVERRIDE;
218 #ifndef ITK_MANUAL_INSTANTIATION
219 #include "itkThresholdLabelerImageFilter.hxx"
void SetLabelOffset(const TOutput &labelOffset)
NumericTraits< TInput >::RealType RealThresholdType
const RealThresholdVector & GetRealThresholds() const
UnaryFunctorImageFilter< TInputImage, TOutputImage, Functor::ThresholdLabeler< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass
TOutput operator()(const TInput &A) const
virtual ~ThresholdLabelerImageFilter() override
Base class for all process objects that output image data.
TOutputImage::PixelType OutputPixelType
std::vector< InputPixelType > ThresholdVector
SmartPointer< const Self > ConstPointer
std::vector< RealThresholdType > RealThresholdVector
void SetThresholds(const RealThresholdVector &thresholds)
void SetThresholds(const ThresholdVector &thresholds)
Label an input image according to a set of thresholds.
ThresholdLabelerImageFilter Self
std::vector< RealThresholdType > RealThresholdVector
NumericTraits< InputPixelType >::RealType RealThresholdType
bool operator!=(const ThresholdLabeler &other) const
Implements pixel-wise generic operation on one image.
TInputImage::PixelType InputPixelType
const ThresholdVector & GetThresholds() const
Control indentation during Print() invocation.
SmartPointer< Self > Pointer
bool operator==(const ThresholdLabeler &other) const
Define additional traits for native types such as int or float.
#define itkConceptMacro(name, concept)
void SetRealThresholds(const RealThresholdVector &thresholds)
RealThresholdVector m_Thresholds