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 > >
121 TInputImage, TOutputImage,
123 typename TInputImage::PixelType,
124 typename TOutputImage::PixelType >
146 #ifdef ITK_USE_CONCEPT_CHECKING
161 m_Thresholds = thresholds;
162 m_RealThresholds.clear();
163 typename ThresholdVector::const_iterator itr = m_Thresholds.begin();
164 while ( itr != m_Thresholds.end() )
166 m_RealThresholds.push_back( static_cast< RealThresholdType >( *itr ) );
175 {
return m_Thresholds; }
180 m_RealThresholds = thresholds;
181 m_Thresholds.clear();
182 typename RealThresholdVector::const_iterator itr = m_RealThresholds.begin();
183 while ( itr != m_RealThresholds.end() )
185 m_Thresholds.push_back( static_cast< InputPixelType >( *itr ) );
194 {
return m_RealThresholds; }
199 itkGetConstMacro(LabelOffset, OutputPixelType);
205 void PrintSelf(std::ostream & os,
Indent indent)
const override;
209 void BeforeThreadedGenerateData()
override;
218 #ifndef ITK_MANUAL_INSTANTIATION
219 #include "itkThresholdLabelerImageFilter.hxx"
void SetLabelOffset(const TOutput &labelOffset)
typename TOutputImage::PixelType OutputPixelType
const RealThresholdVector & GetRealThresholds() const
ThresholdVector m_Thresholds
std::vector< InputPixelType > ThresholdVector
Define numeric traits for std::vector.
typename TInputImage::PixelType InputPixelType
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
typename NumericTraits< InputPixelType >::RealType RealThresholdType
TOutput operator()(const TInput &A) const
std::vector< RealThresholdType > RealThresholdVector
Base class for all process objects that output image data.
RealThresholdVector m_RealThresholds
typename NumericTraits< TInputImage::PixelType >::RealType RealThresholdType
void SetThresholds(const RealThresholdVector &thresholds)
void SetThresholds(const ThresholdVector &thresholds)
Label an input image according to a set of thresholds.
bool operator!=(const ThresholdLabeler &other) const
Implements pixel-wise generic operation on one image.
const ThresholdVector & GetThresholds() const
Control indentation during Print() invocation.
bool operator==(const ThresholdLabeler &other) const
std::vector< RealThresholdType > RealThresholdVector
#define itkConceptMacro(name, concept)
OutputPixelType m_LabelOffset
void SetRealThresholds(const RealThresholdVector &thresholds)
RealThresholdVector m_Thresholds