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 #include "itkDensityFunction.h"
00026
00027 namespace itk
00028 {
00029
00073 template< class TInputImage, class TProbabilityPrecisionType=float >
00074 class ITK_EXPORT BayesianClassifierInitializationImageFilter :
00075 public
00076 ImageToImageFilter<TInputImage, VectorImage< TProbabilityPrecisionType,
00077 ::itk::GetImageDimension< TInputImage >::ImageDimension > >
00078 {
00079 public:
00081 typedef BayesianClassifierInitializationImageFilter Self;
00082 typedef TInputImage InputImageType;
00083 typedef TProbabilityPrecisionType ProbabilityPrecisionType;
00084
00086 itkStaticConstMacro( Dimension, unsigned int,
00087 ::itk::GetImageDimension< InputImageType >::ImageDimension );
00088
00089 typedef VectorImage< ProbabilityPrecisionType,
00090 itkGetStaticConstMacro(Dimension) > OutputImageType;
00091 typedef ImageToImageFilter< InputImageType, OutputImageType > Superclass;
00092 typedef SmartPointer<Self> Pointer;
00093 typedef SmartPointer<const Self> ConstPointer;
00094
00096 itkNewMacro(Self);
00097
00099 itkTypeMacro(BayesianClassifierInitializationImageFilter, ImageToImageFilter);
00100
00102 typedef ImageRegionConstIterator< InputImageType > InputImageIteratorType;
00103
00105 typedef typename InputImageType::PixelType InputPixelType;
00106 typedef typename OutputImageType::PixelType OutputPixelType;
00107
00111 typedef VectorImage< ProbabilityPrecisionType,
00112 itkGetStaticConstMacro(Dimension) > MembershipImageType;
00113 typedef typename MembershipImageType::PixelType MembershipPixelType;
00114 typedef typename MembershipImageType::Pointer MembershipImagePointer;
00115 typedef ImageRegionIterator< MembershipImageType > MembershipImageIteratorType;
00116
00118 typedef Vector< InputPixelType, 1 > MeasurementVectorType;
00119
00121 typedef Statistics::DensityFunction< MeasurementVectorType >
00122 MembershipFunctionType;
00123 typedef typename MembershipFunctionType::Pointer MembershipFunctionPointer;
00124
00126 typedef VectorContainer< unsigned int,
00127 MembershipFunctionPointer > MembershipFunctionContainerType;
00128 typedef typename MembershipFunctionContainerType::Pointer
00129 MembershipFunctionContainerPointer;
00130
00136 virtual void SetMembershipFunctions( MembershipFunctionContainerType
00137 * densityFunctionContainer );
00138 itkGetObjectMacro( MembershipFunctionContainer, MembershipFunctionContainerType );
00140
00142 itkSetMacro( NumberOfClasses, unsigned int );
00143 itkGetMacro( NumberOfClasses, unsigned int );
00145
00146 virtual void GenerateOutputInformation();
00147
00148 #ifdef ITK_USE_CONCEPT_CHECKING
00149
00150 itkConceptMacro(InputMultiplyOperatorCheck,
00151 (Concept::MultiplyOperator<InputPixelType>));
00152 itkConceptMacro(DoubleConvertibleToProbabilityCheck,
00153 (Concept::Convertible<double, TProbabilityPrecisionType>));
00154 itkConceptMacro(InputHasNumericTraitsCheck,
00155 (Concept::HasNumericTraits<InputPixelType>));
00156 itkConceptMacro(ProbabilityHasNumericTraitsCheck,
00157 (Concept::HasNumericTraits<TProbabilityPrecisionType>));
00158 itkConceptMacro(DoublePlusInputCheck,
00159 (Concept::AdditiveOperators<double, InputPixelType>));
00160
00162 #endif
00163
00164 protected:
00165 BayesianClassifierInitializationImageFilter();
00166 virtual ~BayesianClassifierInitializationImageFilter() {}
00167 void PrintSelf(std::ostream& os, Indent indent) const;
00168
00174 virtual void InitializeMembershipFunctions();
00175
00177 virtual void GenerateData();
00178
00179 private:
00180 BayesianClassifierInitializationImageFilter(const Self&);
00181 void operator=(const Self&);
00182
00183 bool m_UserSuppliesMembershipFunctions;
00184 unsigned int m_NumberOfClasses;
00185 typename MembershipFunctionContainerType::Pointer m_MembershipFunctionContainer;
00186 };
00187
00188 }
00189
00190 #ifndef ITK_MANUAL_INSTANTIATION
00191 #include "itkBayesianClassifierInitializationImageFilter.txx"
00192 #endif
00193
00194 #endif
00195