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>
00063 Superclass;
00064 typedef SmartPointer <Self> Pointer;
00065 typedef SmartPointer<const Self> ConstPointer;
00066
00068 itkTypeMacro(VoronoiSegmentationRGBImageFilter,
00069 VoronoiSegmentationImageFilterBase);
00070
00072 itkNewMacro(Self);
00073
00075 typedef typename Superclass::BinaryObjectImage BinaryObjectImage;
00076 typedef typename Superclass::IndexList IndexList;
00077 typedef typename Superclass::IndexType IndexType;
00078 typedef typename Superclass::RegionType RegionType;
00079 typedef typename Superclass::PixelType PixelType;
00080 typedef typename Superclass::InputImagePointer InputImagePointer;
00081 typedef typename Superclass::InputImageType InputImageType;
00082 typedef Vector<float,6> RGBHCVPixel;
00083 typedef Image<RGBHCVPixel> RGBHCVImage;
00084
00086 void SetMeanPercentError(double x[6]);
00087 void SetSTDPercentError(double x[6]);
00088 void GetMeanPercentError(double x[6]){for(int i=0;i<6;i++) x[i]=m_MeanPercentError[i];}
00089 void GetSTDPercentError(double x[6]){for(int i=0;i<6;i++) x[i]=m_STDPercentError[i];}
00090 void GetMean(double x[6]){for(int i=0;i<6;i++) x[i]=m_Mean[i];}
00091 void GetSTD(double x[6]){for(int i=0;i<6;i++) x[i]=m_STD[i];}
00092 void SetMean(double x[6]){for(int i=0;i<6;i++) m_Mean[i]=x[i];}
00093 void SetSTD(double x[6]){for(int i=0;i<6;i++) m_STD[i]=x[i];}
00094 void GetMeanTolerance(double x[6]){for(int i=0;i<6;i++) x[i]=m_MeanTolerance[i];}
00095 void GetSTDTolerance(double x[6]){for(int i=0;i<6;i++) x[i]=m_STDTolerance[i];}
00097
00101 itkSetMacro(MaxValueOfRGB,double);
00102 itkGetConstMacro(MaxValueOfRGB,double);
00104
00107 void SetTestMean(unsigned int t1,unsigned int t2,unsigned int t3){
00108 m_TestMean[0] = t1;
00109 m_TestMean[1] = t2;
00110 m_TestMean[2] = t3;
00111 }
00112 void SetTestSTD(unsigned int t1,unsigned int t2,unsigned int t3){
00113 m_TestSTD[0] = t1;
00114 m_TestSTD[1] = t2;
00115 m_TestSTD[2] = t3;
00116 }
00117 void GetTestMean(unsigned int x[3]){
00118 x[0]=m_TestMean[0];x[1]=m_TestMean[1];x[2]=m_TestMean[2];
00119 }
00120 void GetTestSTD(unsigned int x[3]){
00121 x[0]=m_TestSTD[0];x[1]=m_TestSTD[1];x[2]=m_TestSTD[2];
00122 }
00123 void TakeAPrior(const BinaryObjectImage* aprior);
00125
00126 virtual void SetInput(const InputImageType *input);
00127 virtual void SetInput( unsigned int, const InputImageType * image);
00128
00130 itkStaticConstMacro(InputImageDimension, unsigned int,
00131 TInputImage::ImageDimension );
00132 itkStaticConstMacro(OutputImageDimension, unsigned int,
00133 TOutputImage::ImageDimension );
00135
00136 #ifdef ITK_USE_CONCEPT_CHECKING
00137
00138 itkConceptMacro(SameDimensionCheck,
00139 (Concept::SameDimension<InputImageDimension, OutputImageDimension>));
00140 itkConceptMacro(IntConvertibleToOutputCheck,
00141 (Concept::Convertible<int, typename TOutputImage::PixelType>));
00142
00144 #endif
00145
00146 protected:
00147 VoronoiSegmentationRGBImageFilter();
00148 ~VoronoiSegmentationRGBImageFilter();
00149 void PrintSelf(std::ostream& os, Indent indent) const;
00150
00151 private:
00152 double m_Mean[6];
00153 double m_STD[6];
00154 double m_MeanTolerance[6];
00155 double m_STDTolerance[6];
00156 double m_MeanPercentError[6];
00157 double m_STDPercentError[6];
00158 double m_MaxValueOfRGB;
00159 unsigned int m_TestMean[3];
00160 unsigned int m_TestSTD[3];
00161 typename RGBHCVImage::Pointer m_WorkingImage;
00162
00163 virtual bool TestHomogeneity(IndexList &Plist);
00164
00165 private:
00166 VoronoiSegmentationRGBImageFilter(const Self&);
00167 void operator=(const Self&);
00168 };
00169
00170 }
00171
00172
00173 #ifndef ITK_MANUAL_INSTANTIATION
00174 #include "itkVoronoiSegmentationRGBImageFilter.txx"
00175 #endif
00176
00177 #endif
00178