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 ITK_EXPORT NeighborhoodConnectedImageFilter:
00036 public ImageToImageFilter<TInputImage,TOutputImage>
00037 {
00038 public:
00039
00041 typedef NeighborhoodConnectedImageFilter Self;
00042 typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
00043 typedef SmartPointer<Self> Pointer;
00044 typedef SmartPointer<const Self> ConstPointer;
00045
00047 itkNewMacro(Self);
00048
00050 itkTypeMacro(NeighborhoodConnectedImageFilter,
00051 ImageToImageFilter);
00052
00053 typedef TInputImage InputImageType;
00054 typedef typename InputImageType::Pointer InputImagePointer;
00055 typedef typename InputImageType::RegionType InputImageRegionType;
00056 typedef typename InputImageType::PixelType InputImagePixelType;
00057 typedef typename InputImageType::IndexType IndexType;
00058 typedef typename InputImageType::SizeType InputImageSizeType;
00059
00060 typedef TOutputImage OutputImageType;
00061 typedef typename OutputImageType::Pointer OutputImagePointer;
00062 typedef typename OutputImageType::RegionType OutputImageRegionType;
00063 typedef typename OutputImageType::PixelType OutputImagePixelType;
00064
00065 void PrintSelf ( std::ostream& os, Indent indent ) const;
00066
00068 void ClearSeeds()
00069 {
00070 m_Seeds.clear();
00071 this->Modified();
00072 }
00073
00075 void SetSeed(const IndexType & seed)
00076 {
00077 this->ClearSeeds();
00078 this->AddSeed ( seed );
00079 }
00080
00082 void AddSeed ( const IndexType & seed )
00083 {
00084 m_Seeds.push_back ( seed );
00085 this->Modified();
00086 };
00088
00090 itkSetMacro(Lower, InputImagePixelType);
00091 itkGetMacro(Lower, InputImagePixelType);
00093
00096 itkSetMacro(Upper, InputImagePixelType);
00097 itkGetMacro(Upper, InputImagePixelType);
00099
00103 itkSetMacro(ReplaceValue, OutputImagePixelType);
00104 itkGetMacro(ReplaceValue, OutputImagePixelType);
00106
00108 itkSetMacro(Radius, InputImageSizeType);
00109
00111 itkGetConstReferenceMacro(Radius, InputImageSizeType);
00112
00114 itkStaticConstMacro(InputImageDimension, unsigned int,
00115 TInputImage::ImageDimension);
00116 itkStaticConstMacro(OutputImageDimension, unsigned int,
00117 TOutputImage::ImageDimension);
00119
00120 #ifdef ITK_USE_CONCEPT_CHECKING
00121
00122 itkConceptMacro(InputEqualityComparableCheck,
00123 (Concept::EqualityComparable<InputImagePixelType>));
00124 itkConceptMacro(OutputEqualityComparableCheck,
00125 (Concept::EqualityComparable<OutputImagePixelType>));
00126 itkConceptMacro(SameDimensionCheck,
00127 (Concept::SameDimension<InputImageDimension, OutputImageDimension>));
00128 itkConceptMacro(InputOStreamWritableCheck,
00129 (Concept::OStreamWritable<InputImagePixelType>));
00130 itkConceptMacro(OutputOStreamWritableCheck,
00131 (Concept::OStreamWritable<OutputImagePixelType>));
00132
00134 #endif
00135
00136 protected:
00137 NeighborhoodConnectedImageFilter();
00138 ~NeighborhoodConnectedImageFilter(){};
00139 std::vector<IndexType> m_Seeds;
00140 InputImagePixelType m_Lower;
00141 InputImagePixelType m_Upper;
00142 OutputImagePixelType m_ReplaceValue;
00143 InputImageSizeType m_Radius;
00144
00145
00146
00147 void GenerateInputRequestedRegion();
00148
00149
00150 void EnlargeOutputRequestedRegion(DataObject *output);
00151 void GenerateData();
00152
00153 private:
00154 NeighborhoodConnectedImageFilter(const Self&);
00155 void operator=(const Self&);
00156
00157 };
00158
00159 }
00160
00161 #ifndef ITK_MANUAL_INSTANTIATION
00162 #include "itkNeighborhoodConnectedImageFilter.txx"
00163 #endif
00164
00165 #endif
00166