00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkConnectedComponentImageFilter_h
00018 #define __itkConnectedComponentImageFilter_h
00019
00020 #include "itkImageToImageFilter.h"
00021 #include "itkImage.h"
00022
00023 namespace itk
00024 {
00025
00048 template <class TInputImage, class TOutputImage, class TMaskImage=TInputImage>
00049 class ITK_EXPORT ConnectedComponentImageFilter :
00050 public ImageToImageFilter< TInputImage, TOutputImage >
00051 {
00052 public:
00056 typedef ConnectedComponentImageFilter Self;
00057 typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00058
00062 typedef typename Superclass::InputImagePointer InputImagePointer;
00063
00068 typedef typename TOutputImage::PixelType OutputPixelType;
00069 typedef typename TOutputImage::InternalPixelType OutputInternalPixelType;
00070 typedef typename TInputImage::PixelType InputPixelType;
00071 typedef typename TInputImage::InternalPixelType InputInternalPixelType;
00072 typedef typename TMaskImage::PixelType MaskPixelType;
00073 itkStaticConstMacro(ImageDimension, unsigned int,
00074 TOutputImage::ImageDimension);
00075
00079 typedef TInputImage InputImageType;
00080 typedef TMaskImage MaskImageType;
00081 typedef TOutputImage OutputImageType;
00082 typedef typename TInputImage::IndexType IndexType;
00083 typedef typename TInputImage::SizeType SizeType;
00084 typedef typename TOutputImage::RegionType RegionType;
00085 typedef std::list<IndexType> ListType;
00086
00087 typedef typename MaskImageType::Pointer MaskImagePointer;
00088
00092 typedef SmartPointer<Self> Pointer;
00093 typedef SmartPointer<const Self> ConstPointer;
00094
00098 itkTypeMacro(ConnectedComponentImageFilter, ImageToImageFilter);
00099
00103 itkNewMacro(Self);
00104
00111 itkSetMacro(FullyConnected, bool);
00112 itkGetConstReferenceMacro(FullyConnected, bool);
00113 itkBooleanMacro(FullyConnected);
00115
00116 void SetMaskImage(TMaskImage* mask) {
00117 this->SetNthInput(1, const_cast<TMaskImage *>( mask ));
00118 }
00119
00120 const TMaskImage* GetMaskImage() const {
00121 return (static_cast<const TMaskImage*>(this->ProcessObject::GetInput(1)));
00122 }
00123
00124 protected:
00125 ConnectedComponentImageFilter()
00126 {
00127 m_FullyConnected = false;
00128 }
00129 virtual ~ConnectedComponentImageFilter() {}
00130 ConnectedComponentImageFilter(const Self&) {}
00131
00132 bool m_FullyConnected;
00133
00134 void PrintSelf(std::ostream& os, Indent indent) const;
00135
00139 void GenerateData();
00140
00144 void GenerateInputRequestedRegion();
00145
00150 void EnlargeOutputRequestedRegion(DataObject *itkNotUsed(output));
00151
00152 };
00153
00154 }
00155
00156 #ifndef ITK_MANUAL_INSTANTIATION
00157 #include "itkConnectedComponentImageFilter.txx"
00158 #endif
00159
00160 #endif
00161