00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _itkVoronoiSegmentationRGBImageFilter_h
00018 #define _itkVoronoiSegmentationRGBImageFilter_h
00019
00020 #include "itkImageToImageFilter.h"
00021 #include "itkVoronoiSegmentationImageFilterBase.h"
00022 #include "itkImage.h"
00023
00024 namespace itk
00025 {
00026
00054 template <class TInputImage, class TOutputImage>
00055 class ITK_EXPORT VoronoiSegmentationRGBImageFilter:
00056 public VoronoiSegmentationImageFilterBase<TInputImage,TOutputImage>
00057 {
00058
00059 public:
00061 typedef VoronoiSegmentationRGBImageFilter Self;
00062 typedef VoronoiSegmentationImageFilterBase<TInputImage,TOutputImage> Superclass;
00063 typedef SmartPointer <Self> Pointer;
00064 typedef SmartPointer<const Self> ConstPointer;
00065
00067 itkTypeMacro(VoronoiSegmentationRGBImageFilter,
00068 VoronoiSegmentationImageFilterBase);
00069
00071 itkNewMacro(Self);
00072
00074 typedef typename Superclass::BinaryObjectImage BinaryObjectImage;
00075 typedef typename Superclass::IndexList IndexList;
00076 typedef typename Superclass::IndexType IndexType;
00077 typedef typename Superclass::RegionType RegionType;
00078 typedef typename Superclass::PixelType PixelType;
00079 typedef typename Superclass::InputImagePointer InputImagePointer;
00080 typedef typename Superclass::InputImageType InputImageType;
00081 typedef Vector<float,6> RGBHCVPixel;
00082 typedef Image<RGBHCVPixel> RGBHCVImage;
00083
00085 void SetMeanPercentError(double x[6]);
00086 void SetSTDPercentError(double x[6]);
00087 void GetMeanPercentError(double x[6]){for(int i=0;i<6;i++) x[i]=m_MeanPercentError[i];};
00088 void GetSTDPercentError(double x[6]){for(int i=0;i<6;i++) x[i]=m_STDPercentError[i];};
00089 void GetMean(double x[6]){for(int i=0;i<6;i++) x[i]=m_Mean[i];};
00090 void GetSTD(double x[6]){for(int i=0;i<6;i++) x[i]=m_STD[i];};
00091 void SetMean(double x[6]){for(int i=0;i<6;i++) m_Mean[i]=x[i];};
00092 void SetSTD(double x[6]){for(int i=0;i<6;i++) m_STD[i]=x[i];};
00093 void GetMeanTolerance(double x[6]){for(int i=0;i<6;i++) x[i]=m_MeanTolerance[i];};
00094 void GetSTDTolerance(double x[6]){for(int i=0;i<6;i++) x[i]=m_STDTolerance[i];};
00096
00100 itkSetMacro(MaxValueOfRGB,double);
00101 itkGetMacro(MaxValueOfRGB,double);
00103
00106 void SetTestMean(unsigned int t1,unsigned int t2,unsigned int t3){
00107 m_TestMean[0] = t1;
00108 m_TestMean[1] = t2;
00109 m_TestMean[2] = t3;
00110 }
00111 void SetTestSTD(unsigned int t1,unsigned int t2,unsigned int t3){
00112 m_TestSTD[0] = t1;
00113 m_TestSTD[1] = t2;
00114 m_TestSTD[2] = t3;
00115 }
00116 void GetTestMean(unsigned int x[3]){
00117 x[0]=m_TestMean[0];x[1]=m_TestMean[1];x[2]=m_TestMean[2];
00118 }
00119 void GetTestSTD(unsigned int x[3]){
00120 x[0]=m_TestSTD[0];x[1]=m_TestSTD[1];x[2]=m_TestSTD[2];
00121 }
00122 void TakeAPrior(const BinaryObjectImage* aprior);
00124
00125 virtual void SetInput(const InputImageType *input);
00126 virtual void SetInput( unsigned int, const InputImageType * image);
00127
00129 itkStaticConstMacro(InputImageDimension, unsigned int,
00130 TInputImage::ImageDimension );
00131 itkStaticConstMacro(OutputImageDimension, unsigned int,
00132 TOutputImage::ImageDimension );
00134
00135 #ifdef ITK_USE_CONCEPT_CHECKING
00136
00137 itkConceptMacro(SameDimensionCheck,
00138 (Concept::SameDimension<InputImageDimension, OutputImageDimension>));
00139 itkConceptMacro(IntConvertibleToOutputCheck,
00140 (Concept::Convertible<int, typename TOutputImage::PixelType>));
00141
00143 #endif
00144
00145 protected:
00146 VoronoiSegmentationRGBImageFilter();
00147 ~VoronoiSegmentationRGBImageFilter();
00148 void PrintSelf(std::ostream& os, Indent indent) const;
00149
00150 private:
00151 double m_Mean[6];
00152 double m_STD[6];
00153 double m_MeanTolerance[6];
00154 double m_STDTolerance[6];
00155 double m_MeanPercentError[6];
00156 double m_STDPercentError[6];
00157 double m_MaxValueOfRGB;
00158 unsigned int m_TestMean[3];
00159 unsigned int m_TestSTD[3];
00160 typename RGBHCVImage::Pointer m_WorkingImage;
00161
00162 virtual bool TestHomogeneity(IndexList &Plist);
00163
00164 private:
00165 VoronoiSegmentationRGBImageFilter(const Self&);
00166 void operator=(const Self&);
00167 };
00168
00169 }
00170
00171
00172 #ifndef ITK_MANUAL_INSTANTIATION
00173 #include "itkVoronoiSegmentationRGBImageFilter.txx"
00174 #endif
00175
00176 #endif
00177
00178
00179
00180
00181