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 itkStaticConstMacro(ImageDimension, unsigned int,
00073 TOutputImage::ImageDimension);
00074
00078 typedef TInputImage InputImageType;
00079 typedef TMaskImage MaskImageType;
00080 typedef TOutputImage OutputImageType;
00081 typedef typename TInputImage::IndexType IndexType;
00082 typedef typename TInputImage::SizeType SizeType;
00083 typedef typename TOutputImage::RegionType RegionType;
00084 typedef std::list<IndexType> ListType;
00085
00086 typedef typename MaskImageType::Pointer MaskImagePointer;
00087
00091 typedef SmartPointer<Self> Pointer;
00092 typedef SmartPointer<const Self> ConstPointer;
00093
00097 itkTypeMacro(ConnectedComponentImageFilter, ImageToImageFilter);
00098
00102 itkNewMacro(Self);
00103
00110 itkSetMacro(FullyConnected, bool);
00111 itkGetConstReferenceMacro(FullyConnected, bool);
00112 itkBooleanMacro(FullyConnected);
00113
00114 void SetMaskImage(TMaskImage* mask) {
00115 this->SetNthInput(1, const_cast<TMaskImage *>( mask ));
00116 }
00117
00118 const TMaskImage* GetMaskImage() const {
00119 return (static_cast<const TMaskImage*>(this->ProcessObject::GetInput(1)));
00120 }
00121
00122 protected:
00123 ConnectedComponentImageFilter()
00124 {
00125 m_FullyConnected = false;
00126 }
00127 virtual ~ConnectedComponentImageFilter() {}
00128 ConnectedComponentImageFilter(const Self&) {}
00129
00130 bool m_FullyConnected;
00131
00132 void PrintSelf(std::ostream& os, Indent indent) const;
00133
00137 void GenerateData();
00138
00142 void GenerateInputRequestedRegion();
00143
00148 void EnlargeOutputRequestedRegion(DataObject *itkNotUsed(output));
00149
00150 };
00151
00152 }
00153
00154 #ifndef ITK_MANUAL_INSTANTIATION
00155 #include "itkConnectedComponentImageFilter.txx"
00156 #endif
00157
00158 #endif