/*========================================================================= Program: Insight Segmentation & Registration Toolkit Module: $RCSfile: itkImageToComponentTreeFilter.h,v $ Language: C++ Date: $Date: 2006/03/28 19:59:05 $ Version: $Revision: 1.6 $ Copyright (c) Insight Software Consortium. All rights reserved. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef __itkImageToComponentTreeFilter_h #define __itkImageToComponentTreeFilter_h #include "itkImageToImageFilter.h" namespace itk { namespace Function { /** a functor to make std::map accept pointers as key */ template class PointerHash { public: unsigned long operator() (TYPE t) const { return reinterpret_cast (t); } }; } /** \class ImageToComponentTreeFilter * \brief * * \ingroup ImageEnhancement MathematicalMorphologyImageFilters */ template class ITK_EXPORT ImageToComponentTreeFilter : public ImageToImageFilter { public: /** Standard class typedefs. */ typedef ImageToComponentTreeFilter Self; typedef ImageToImageFilter Superclass; typedef SmartPointer Pointer; typedef SmartPointer ConstPointer; /** Some convenient typedefs. */ typedef TInputImage InputImageType; typedef TOutputImage OutputImageType; typedef typename InputImageType::Pointer InputImagePointer; typedef typename InputImageType::ConstPointer InputImageConstPointer; typedef typename InputImageType::RegionType InputImageRegionType; typedef typename InputImageType::PixelType InputImagePixelType; typedef typename OutputImageType::Pointer OutputImagePointer; typedef typename OutputImageType::ConstPointer OutputImageConstPointer; typedef typename OutputImageType::RegionType OutputImageRegionType; typedef typename OutputImageType::PixelType OutputImagePixelType; typedef typename OutputImageType::NodeType NodeType; typedef typename OutputImageType::AttributeType AttributeType; typedef typename OutputImageType::IndexType IndexType; /** ImageDimension constants */ itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension); /** Standard New method. */ itkNewMacro(Self); /** Runtime information support. */ itkTypeMacro(ImageToComponentTreeFilter, ImageToImageFilter); /** * Set/Get whether the connected components are defined strictly by * face connectivity or by face+edge+vertex connectivity. Default is * FullyConnectedOff. For objects that are 1 pixel wide, use * FullyConnectedOn. */ itkSetMacro(FullyConnected, bool); itkGetConstReferenceMacro(FullyConnected, bool); itkBooleanMacro(FullyConnected); #ifdef ITK_USE_CONCEPT_CHECKING /** Begin concept checking */ /* itkConceptMacro(InputEqualityComparableCheck, (Concept::EqualityComparable)); itkConceptMacro(IntConvertibleToInputCheck, (Concept::Convertible)); itkConceptMacro(InputOStreamWritableCheck, (Concept::OStreamWritable));*/ /** End concept checking */ #endif protected: ImageToComponentTreeFilter(); ~ImageToComponentTreeFilter() {}; void PrintSelf(std::ostream& os, Indent indent) const; /** ImageToComponentTreeFilter needs the entire input be * available. Thus, it needs to provide an implementation of * GenerateInputRequestedRegion(). */ void GenerateInputRequestedRegion() ; /** ImageToComponentTreeFilter will produce the entire output. */ void EnlargeOutputRequestedRegion(DataObject *itkNotUsed(output)); /** Single-threaded version of GenerateData. This filter delegates * to GrayscaleGeodesicErodeImageFilter. */ void GenerateData(); /** Merge node2 in node1 without setting the parent. This operation is * performed in constant time */ void LightMerge( NodeType* node1, NodeType* node2 ); /** Set the parent of all the nodes of the tree */ void SetChildrenParent( NodeType* node ); /** return the ancestor (deepest parent) of a node and perform path * compression on all the node on the path */ NodeType * GetAncestor( NodeType * node ); /** return the reference node of a node */ NodeType * GetReference( NodeType * node ); private: ImageToComponentTreeFilter(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented bool m_FullyConnected; } ; // end of class } // end namespace itk #ifndef ITK_MANUAL_INSTANTIATION #include "itkImageToComponentTreeFilter.txx" #endif #endif