00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkBayesianClassifierInitializationImageFilter_h
00018 #define __itkBayesianClassifierInitializationImageFilter_h
00019
00020 #include "itkVectorImage.h"
00021 #include "itkVectorContainer.h"
00022 #include "itkImageToImageFilter.h"
00023 #include "itkImageRegionIterator.h"
00024 #include "itkImageRegionConstIterator.h"
00025 #ifdef ITK_USE_REVIEW_STATISTICS
00026 #include "itkMembershipFunctionBase.h"
00027 #else
00028 #include "itkDensityFunction.h"
00029 #endif
00030
00031 namespace itk
00032 {
00033
00077 template< class TInputImage, class TProbabilityPrecisionType=float >
00078 class ITK_EXPORT BayesianClassifierInitializationImageFilter :
00079 public
00080 ImageToImageFilter<TInputImage, VectorImage< TProbabilityPrecisionType,
00081 ::itk::GetImageDimension< TInputImage >::ImageDimension > >
00082 {
00083 public:
00085 typedef BayesianClassifierInitializationImageFilter Self;
00086 typedef TInputImage InputImageType;
00087 typedef TProbabilityPrecisionType ProbabilityPrecisionType;
00088
00090 itkStaticConstMacro( Dimension, unsigned int,
00091 ::itk::GetImageDimension< InputImageType >::ImageDimension );
00092
00093 typedef VectorImage< ProbabilityPrecisionType,
00094 itkGetStaticConstMacro(Dimension) > OutputImageType;
00095 typedef ImageToImageFilter< InputImageType, OutputImageType > Superclass;
00096 typedef SmartPointer<Self> Pointer;
00097 typedef SmartPointer<const Self> ConstPointer;
00098
00100 itkNewMacro(Self);
00101
00103 itkTypeMacro(BayesianClassifierInitializationImageFilter, ImageToImageFilter);
00104
00106 typedef ImageRegionConstIterator< InputImageType > InputImageIteratorType;
00107
00109 typedef typename InputImageType::PixelType InputPixelType;
00110 typedef typename OutputImageType::PixelType OutputPixelType;
00111
00115 typedef VectorImage< ProbabilityPrecisionType,
00116 itkGetStaticConstMacro(Dimension) > MembershipImageType;
00117 typedef typename MembershipImageType::PixelType MembershipPixelType;
00118 typedef typename MembershipImageType::Pointer MembershipImagePointer;
00119 typedef ImageRegionIterator< MembershipImageType > MembershipImageIteratorType;
00120
00122 typedef Vector< InputPixelType, 1 > MeasurementVectorType;
00123
00125 #ifdef ITK_USE_REVIEW_STATISTICS
00126 typedef Statistics::MembershipFunctionBase< MeasurementVectorType > MembershipFunctionType;
00127 #else
00128 typedef Statistics::DensityFunction< MeasurementVectorType >
00129 MembershipFunctionType;
00130 #endif
00131
00132 typedef typename MembershipFunctionType::Pointer MembershipFunctionPointer;
00133
00135 typedef VectorContainer< unsigned int,
00136 MembershipFunctionPointer > MembershipFunctionContainerType;
00137 typedef typename MembershipFunctionContainerType::Pointer
00138 MembershipFunctionContainerPointer;
00139
00145 virtual void SetMembershipFunctions( MembershipFunctionContainerType
00146 * densityFunctionContainer );
00147 itkGetObjectMacro( MembershipFunctionContainer, MembershipFunctionContainerType );
00149
00151 itkSetMacro( NumberOfClasses, unsigned int );
00152 itkGetConstMacro( NumberOfClasses, unsigned int );
00154
00155 virtual void GenerateOutputInformation();
00156
00157 #ifdef ITK_USE_CONCEPT_CHECKING
00158
00159 itkConceptMacro(InputMultiplyOperatorCheck,
00160 (Concept::MultiplyOperator<InputPixelType>));
00161 itkConceptMacro(DoubleConvertibleToProbabilityCheck,
00162 (Concept::Convertible<double, TProbabilityPrecisionType>));
00163 itkConceptMacro(InputHasNumericTraitsCheck,
00164 (Concept::HasNumericTraits<InputPixelType>));
00165 itkConceptMacro(ProbabilityHasNumericTraitsCheck,
00166 (Concept::HasNumericTraits<TProbabilityPrecisionType>));
00167 itkConceptMacro(DoublePlusInputCheck,
00168 (Concept::AdditiveOperators<double, InputPixelType>));
00169
00171 #endif
00172
00173 protected:
00174 BayesianClassifierInitializationImageFilter();
00175 virtual ~BayesianClassifierInitializationImageFilter() {}
00176 void PrintSelf(std::ostream& os, Indent indent) const;
00177
00183 virtual void InitializeMembershipFunctions();
00184
00186 virtual void GenerateData();
00187
00188 private:
00189 BayesianClassifierInitializationImageFilter(const Self&);
00190 void operator=(const Self&);
00191
00192 bool m_UserSuppliesMembershipFunctions;
00193 unsigned int m_NumberOfClasses;
00194
00195 typename MembershipFunctionContainerType::Pointer m_MembershipFunctionContainer;
00196 };
00197
00198 }
00199
00200 #ifndef ITK_MANUAL_INSTANTIATION
00201 #include "itkBayesianClassifierInitializationImageFilter.txx"
00202 #endif
00203
00204 #endif
00205