Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkImageClassifierFilter_h
00018 #define __itkImageClassifierFilter_h
00019
00020 #include <vector>
00021
00022 #include "itkMembershipFunctionBase.h"
00023 #include "itkDecisionRule.h"
00024 #include "itkImageToImageFilter.h"
00025 #include "itkSimpleDataObjectDecorator.h"
00026
00027 namespace itk {
00028 namespace Statistics {
00029
00044 template< class TSample, class TInputImage, class TOutputImage >
00045 class ITK_EXPORT ImageClassifierFilter :
00046 public ImageToImageFilter<TInputImage, TOutputImage>
00047 {
00048 public:
00050 typedef ImageClassifierFilter Self;
00051 typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
00052 typedef SmartPointer< Self > Pointer;
00053 typedef SmartPointer<const Self> ConstPointer;
00054
00056 itkTypeMacro(ImageClassifierFilter, ImageToImagefilter);
00057 itkNewMacro(Self);
00059
00061 typedef TInputImage InputImageType;
00062 typedef TOutputImage OutputImageType;
00063 typedef typename TInputImage::PixelType InputPixelType;
00064 typedef typename TOutputImage::PixelType OutputPixelType;
00065
00067 typedef typename TInputImage::Pointer InputImagePointer;
00068 typedef typename TOutputImage::Pointer OutputImagePointer;
00069
00070 typedef typename TInputImage::SizeType InputSizeType;
00071 typedef typename TInputImage::IndexType InputIndexType;
00072 typedef typename TInputImage::RegionType InputImageRegionType;
00073 typedef typename TOutputImage::SizeType OutputSizeType;
00074 typedef typename TOutputImage::IndexType OutputIndexType;
00075 typedef typename TOutputImage::RegionType OutputImageRegionType;
00076
00078 itkStaticConstMacro(InputImageDimension, unsigned int,
00079 TInputImage::ImageDimension );
00080 itkStaticConstMacro(OutputImageDimension, unsigned int,
00081 TOutputImage::ImageDimension );
00083
00085 typedef TSample SampleType;
00086
00088 typedef typename SampleType::MeasurementType MeasurementType;
00089 typedef typename SampleType::MeasurementVectorType MeasurementVectorType;
00090
00092 typedef MembershipFunctionBase< MeasurementVectorType > MembershipFunctionType;
00093 typedef typename MembershipFunctionType::ConstPointer MembershipFunctionPointer;
00094 typedef std::vector< MembershipFunctionPointer > MembershipFunctionVectorType;
00095 typedef SimpleDataObjectDecorator<
00096 MembershipFunctionVectorType > MembershipFunctionVectorObjectType;
00097 typedef typename
00098 MembershipFunctionVectorObjectType::Pointer MembershipFunctionVectorObjectPointer;
00099
00101 typedef Array< double > MembershipFunctionsWeightsArrayType;
00102
00103 typedef SimpleDataObjectDecorator<
00104 MembershipFunctionsWeightsArrayType > MembershipFunctionsWeightsArrayObjectType;
00105 typedef typename
00106 MembershipFunctionsWeightsArrayObjectType::Pointer MembershipFunctionsWeightsArrayPointer;
00107
00109 typedef unsigned long ClassLabelType;
00110 typedef std::vector< ClassLabelType > ClassLabelVectorType;
00111 typedef SimpleDataObjectDecorator<
00112 ClassLabelVectorType > ClassLabelVectorObjectType;
00113 typedef ClassLabelVectorObjectType::Pointer ClassLabelVectorObjectPointer;
00114
00115
00117 typedef DecisionRule DecisionRuleType;
00118 typedef DecisionRuleType::ConstPointer DecisionRulePointer;
00119
00121 void SetImage(const InputImageType * image);
00122 const InputImageType * GetImage() const;
00124
00128 itkSetMacro( NumberOfClasses, unsigned int );
00129 itkGetConstMacro( NumberOfClasses, unsigned int );
00131
00133 itkSetConstObjectMacro( DecisionRule, DecisionRuleType );
00134 itkGetConstObjectMacro( DecisionRule, DecisionRuleType );
00136
00140 void SetClassLabels(const ClassLabelVectorObjectType * classLabels );
00141
00145 void SetMembershipFunctions(const MembershipFunctionVectorObjectType * membershipFunctions );
00146
00148 void SetMembershipFunctionsWeightsArray(const MembershipFunctionsWeightsArrayObjectType * weightsArray );
00149
00150
00151 protected:
00152 ImageClassifierFilter();
00153 virtual ~ImageClassifierFilter() {}
00154 void PrintSelf(std::ostream& os, Indent indent) const;
00155
00156 ImageClassifierFilter(const Self&);
00157 void operator=(const Self&);
00158
00159
00161 void GenerateData();
00162
00163 private:
00164
00165 unsigned int m_NumberOfClasses;
00166
00168 DecisionRulePointer m_DecisionRule;
00169
00170 };
00171
00172
00173 }
00174 }
00175
00176
00177 #ifndef ITK_MANUAL_INSTANTIATION
00178 #include "itkImageClassifierFilter.txx"
00179 #endif
00180
00181 #endif
00182