18 #ifndef itkAttributeMorphologyBaseImageFilter_h
19 #define itkAttributeMorphologyBaseImageFilter_h
62 template<
typename TInputImage,
typename TOutputImage,
typename TAttribute,
typename TFunction >
90 itkStaticConstMacro(ImageDimension,
unsigned int,
91 TOutputImage::ImageDimension);
126 itkSetMacro(FullyConnected,
bool);
127 itkGetConstReferenceMacro(FullyConnected,
bool);
128 itkBooleanMacro(FullyConnected);
143 m_FullyConnected =
false;
144 m_AttributeValuePerPixel = 1;
150 void PrintSelf(std::ostream & os,
Indent indent)
const ITK_OVERRIDE;
155 void GenerateData() ITK_OVERRIDE;
160 void GenerateInputRequestedRegion() ITK_OVERRIDE;
166 void EnlargeOutputRequestedRegion(
DataObject * itkNotUsed(output) ) ITK_OVERRIDE;
172 bool m_FullyConnected;
177 itkStaticConstMacro(ACTIVE, OffsetValueType, -2);
178 itkStaticConstMacro(ROOT, OffsetValueType, -3);
187 void SetupOffsetVec(OffsetDirectVecType & PosOffsets, OffsetVecType & Offsets);
210 if ( m_TFunction(l.
Val, r.
Val) )
227 m_Parent[x] = ACTIVE;
228 m_AuxData[x] = m_AttributeValuePerPixel;
233 if ( m_Parent[x] >= 0 )
235 m_Parent[x] = FindRoot(m_Parent[x]);
236 return ( m_Parent[x] );
246 return ( ( m_Raw[x] == m_Raw[y] ) || ( m_AuxData[x] < m_Lambda ) );
255 if ( Criterion(r, p) )
257 m_AuxData[p] += m_AuxData[r];
262 m_AuxData[p] = m_Lambda;
271 m_Parent[x] = ACTIVE;
272 m_AuxData[x] = m_AttributeValuePerPixel;
277 if ( ( m_Parent[y] == ACTIVE ) && ( m_Parent[x] == ACTIVE ) )
280 m_AuxData[y] = m_AuxData[x] + m_AuxData[y];
281 m_AuxData[x] = -m_AttributeValuePerPixel;
283 else if ( m_Parent[x] == ACTIVE )
285 m_AuxData[x] = -m_AttributeValuePerPixel;
289 m_AuxData[y] = -m_AttributeValuePerPixel;
290 m_Parent[y] = INACTIVE;
297 if ( m_Parent[x] >= 0 )
299 m_Parent[x] = FindRoot(m_Parent[x]);
300 return ( m_Parent[x] );
310 return ( ( m_Raw[x] == m_Raw[y] ) || ( m_Parent[x] == ACTIVE ) );
323 else if ( m_Parent[p] == ACTIVE )
325 m_Parent[p] = INACTIVE;
326 m_AuxData[p] = -m_AttributeValuePerPixel;
335 #ifndef ITK_MANUAL_INSTANTIATION
336 #include "itkAttributeMorphologyBaseImageFilter.hxx"
OffsetValueType FindRoot(OffsetValueType x)
bool Criterion(OffsetValueType x, OffsetValueType y)
bool operator()(GreyAndPos const &l, GreyAndPos const &r) const
signed long OffsetValueType
ImageToImageFilter< TInputImage, TOutputImage > Superclass
TInputImage::InternalPixelType InputInternalPixelType
TInputImage::OffsetType OffsetType
TInputImage::IndexType IndexType
Base class for all process objects that output image data.
OffsetValueType * m_Parent
GreyAndPos * m_SortPixels
SmartPointer< Self > Pointer
void Union(OffsetValueType n, OffsetValueType p)
SmartPointer< const Self > ConstPointer
std::list< IndexType > ListType
TInputImage::PixelType InputPixelType
TInputImage::SizeType SizeType
TOutputImage::InternalPixelType OutputInternalPixelType
AttributeMorphologyBaseImageFilter()
std::vector< OffsetValueType > OffsetDirectVecType
virtual ~AttributeMorphologyBaseImageFilter()
Base class for filters that take an image as input and produce an image as output.
TOutputImage::RegionType RegionType
Superclass::InputImagePointer InputImagePointer
Control indentation during Print() invocation.
AttributeMorphologyBaseImageFilter Self
ImageBaseType::SizeType SizeType
TInputImage InputImageType
TOutputImage OutputImageType
AttributeMorphologyBaseImageFilter(const Self &)
void MakeSet(OffsetValueType x)
Morphological opening by attributes.
Base class for all data objects in ITK.
TOutputImage::PixelType OutputPixelType
ImageBaseType::IndexType IndexType
std::vector< OffsetType > OffsetVecType