00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkNeighborhoodConnectedImageFilter_h
00018 #define __itkNeighborhoodConnectedImageFilter_h
00019
00020 #include "itkImage.h"
00021 #include "itkImageToImageFilter.h"
00022
00023 namespace itk{
00024
00034 template <class TInputImage, class TOutputImage>
00035 class NeighborhoodConnectedImageFilter:
00036 public ImageToImageFilter<TInputImage,TOutputImage>
00037 {
00038 public:
00040 typedef NeighborhoodConnectedImageFilter Self;
00041 typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
00042 typedef SmartPointer<Self> Pointer;
00043 typedef SmartPointer<const Self> ConstPointer;
00044
00046 itkNewMacro(Self);
00047
00049 itkTypeMacro(NeighborhoodConnectedImageFilter,
00050 ImageToImageFilter);
00051
00052 typedef TInputImage InputImageType;
00053 typedef typename InputImageType::Pointer InputImagePointer;
00054 typedef typename InputImageType::RegionType InputImageRegionType;
00055 typedef typename InputImageType::PixelType InputImagePixelType;
00056 typedef typename InputImageType::IndexType IndexType;
00057 typedef typename InputImageType::SizeType InputImageSizeType;
00058
00059 typedef TOutputImage OutputImageType;
00060 typedef typename OutputImageType::Pointer OutputImagePointer;
00061 typedef typename OutputImageType::RegionType OutputImageRegionType;
00062 typedef typename OutputImageType::PixelType OutputImagePixelType;
00063
00064 void PrintSelf ( std::ostream& os, Indent indent ) const;
00065
00067 void ClearSeeds()
00068 {
00069 m_Seeds.clear();
00070 this->Modified();
00071 }
00073 void SetSeed(const IndexType & seed)
00074 {
00075 this->ClearSeeds();
00076 this->AddSeed ( seed );
00077 }
00079 void AddSeed ( const IndexType & seed )
00080 {
00081 m_Seeds.push_back ( seed );
00082 this->Modified();
00083 };
00084
00086 itkSetMacro(Lower, InputImagePixelType);
00087 itkGetMacro(Lower, InputImagePixelType);
00088
00091 itkSetMacro(Upper, InputImagePixelType);
00092 itkGetMacro(Upper, InputImagePixelType);
00093
00097 itkSetMacro(ReplaceValue, OutputImagePixelType);
00098 itkGetMacro(ReplaceValue, OutputImagePixelType);
00099
00101 itkSetMacro(Radius, InputImageSizeType);
00102
00104 itkGetConstReferenceMacro(Radius, InputImageSizeType);
00105
00106 protected:
00107 NeighborhoodConnectedImageFilter();
00108 ~NeighborhoodConnectedImageFilter(){};
00109 std::vector<IndexType> m_Seeds;
00110 InputImagePixelType m_Lower;
00111 InputImagePixelType m_Upper;
00112 OutputImagePixelType m_ReplaceValue;
00113 InputImageSizeType m_Radius;
00114
00115
00116
00117 void GenerateInputRequestedRegion();
00118
00119
00120 void EnlargeOutputRequestedRegion(DataObject *output);
00121 void GenerateData();
00122
00123 private:
00124 NeighborhoodConnectedImageFilter(const Self&);
00125 void operator=(const Self&);
00126
00127 };
00128
00129 }
00130
00131 #ifndef ITK_MANUAL_INSTANTIATION
00132 #include "itkNeighborhoodConnectedImageFilter.txx"
00133 #endif
00134
00135 #endif