00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkSimpleFuzzyConnectednessRGBImageFilter_h
00018 #define __itkSimpleFuzzyConnectednessRGBImageFilter_h
00019
00020 #include "itkImage.h"
00021 #include "itkImageToImageFilter.h"
00022 #include "itkSimpleFuzzyConnectednessImageFilterBase.h"
00023 #include <vnl/vnl_matrix_fixed.h>
00024
00025 #include <queue>
00026
00027 namespace itk{
00028
00077 template <class TInputImage, class TOutputImage>
00078 class SimpleFuzzyConnectednessRGBImageFilter:
00079 public SimpleFuzzyConnectednessImageFilterBase<TInputImage,TOutputImage>
00080 {
00081 public:
00083 typedef SimpleFuzzyConnectednessRGBImageFilter Self;
00084 typedef SimpleFuzzyConnectednessImageFilterBase<TInputImage,TOutputImage>
00085 Superclass;
00086 typedef SmartPointer <Self> Pointer;
00087 typedef SmartPointer<const Self> ConstPointer;
00088
00090 itkNewMacro(Self);
00091
00093 itkTypeMacro(SimpleFuzzyConnectednessRGBImageFilter,
00094 SimpleFuzzyConnectednessImageFilterBase);
00095
00097 typedef typename TInputImage::PixelType PixelType;
00098
00100 itkSetVectorMacro(Mean,double,3);
00101 void GetMean(double omean[3])
00102 {
00103 omean[0]=m_Mean[0];omean[1]=m_Mean[1];omean[2]=m_Mean[2];
00104 }
00105 void SetVariance(double ivar[3][3])
00106 {
00107 m_Variance[0][0]=ivar[0][0];m_Variance[0][1]=ivar[0][1];m_Variance[0][2]=ivar[0][2];
00108 m_Variance[1][0]=ivar[1][0];m_Variance[1][1]=ivar[1][1];m_Variance[1][2]=ivar[1][2];
00109 m_Variance[2][0]=ivar[2][0];m_Variance[2][1]=ivar[2][2];m_Variance[2][2]=ivar[2][2];
00110 }
00111 void GetVariance(double ovar[3][3])
00112 {
00113 ovar[0][0]=m_Variance[0][0];ovar[0][1]=m_Variance[0][1];ovar[0][2]=m_Variance[0][2];
00114 ovar[1][0]=m_Variance[1][0];ovar[1][1]=m_Variance[1][1];ovar[1][2]=m_Variance[1][2];
00115 ovar[2][0]=m_Variance[2][0];ovar[2][1]=m_Variance[2][1];ovar[2][2]=m_Variance[2][2];
00116 }
00117 itkSetVectorMacro(Diff_Mean,double,3);
00118 void GetDiff_Mean(double odmean[3])
00119 {
00120 odmean[0]=m_Diff_Mean[0];odmean[1]=m_Diff_Mean[1];odmean[2]=m_Diff_Mean[2];
00121 };
00122 void SetDiff_Variance(double idvar[3][3])
00123 {
00124 m_Diff_Variance[0][0]=idvar[0][0];m_Diff_Variance[0][1]=idvar[0][1];m_Diff_Variance[0][2]=idvar[0][2];
00125 m_Diff_Variance[1][0]=idvar[1][0];m_Diff_Variance[1][1]=idvar[1][1];m_Diff_Variance[1][2]=idvar[1][2];
00126 m_Diff_Variance[2][0]=idvar[2][0];m_Diff_Variance[2][1]=idvar[2][1];m_Diff_Variance[2][2]=idvar[2][2];
00127 }
00128 void GetDiff_Variance(double odvar[3][3])
00129 {
00130 odvar[0][0]=m_Diff_Variance[0][0];odvar[0][1]=m_Diff_Variance[0][1];odvar[0][2]=m_Diff_Variance[0][2];
00131 odvar[1][0]=m_Diff_Variance[1][0];odvar[1][1]=m_Diff_Variance[1][1];odvar[1][2]=m_Diff_Variance[1][2];
00132 odvar[2][0]=m_Diff_Variance[2][0];odvar[2][1]=m_Diff_Variance[2][1];odvar[2][2]=m_Diff_Variance[2][2];
00133 }
00134
00135 protected:
00136 SimpleFuzzyConnectednessRGBImageFilter();
00137 ~SimpleFuzzyConnectednessRGBImageFilter();
00138
00139 void GenerateData(void);
00140
00141 private:
00142 SimpleFuzzyConnectednessRGBImageFilter(const Self&);
00143 void operator=(const Self&);
00144
00145 double m_Mean[3];
00146 double m_Variance[3][3];
00147 double m_Diff_Mean[3];
00148 double m_Diff_Variance[3][3];
00149
00150 double m_VarianceInverse[3][3];
00151 double m_Diff_VarianceInverse[3][3];
00152 double m_VarianceDet;
00153 double m_Diff_VarianceDet;
00154
00155 virtual double FuzzyAffinity(const PixelType f1, const PixelType f2);
00156 };
00157
00158
00159 }
00161 #ifndef ITK_MANUAL_INSTANTIATION
00162 #include "itkSimpleFuzzyConnectednessRGBImageFilter.txx"
00163 #endif
00164
00165 #endif