Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkImageClassifierFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkImageClassifierFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-06-15 12:40:37 $
00007   Version:   $Revision: 1.2 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
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&); //purposely not implemented
00157   void operator=(const Self&); //purposely not implemented
00158 
00159 
00161   void GenerateData();
00162 
00163 private:
00164  
00165   unsigned int                     m_NumberOfClasses;
00166 
00168   DecisionRulePointer              m_DecisionRule;
00169 
00170 }; // end of class
00171 
00172 
00173 } // end of namespace Statistics 
00174 } // end of namespace itk
00175 
00176 
00177 #ifndef ITK_MANUAL_INSTANTIATION
00178 #include "itkImageClassifierFilter.txx"
00179 #endif
00180 
00181 #endif
00182 

Generated at Tue Sep 15 03:17:28 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000