00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkImageClassifierBase.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-04-23 03:53:35 $ 00007 Version: $Revision: 1.9 $ 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 __itkImageClassifierBase_h 00018 #define __itkImageClassifierBase_h 00019 00020 #include "itkClassifierBase.h" 00021 #include "itkExceptionObject.h" 00022 #include "itkImageRegionIterator.h" 00023 #include "itkImageRegionConstIterator.h" 00024 00025 namespace itk 00026 { 00027 00069 template <class TInputImage, 00070 class TClassifiedImage> 00071 class ITK_EXPORT ImageClassifierBase: 00072 public ClassifierBase<TInputImage> 00073 { 00074 public: 00076 typedef ImageClassifierBase Self; 00077 typedef ClassifierBase<TInputImage> Superclass; 00078 typedef SmartPointer<Self> Pointer; 00079 typedef SmartPointer<const Self> ConstPointer; 00080 00082 itkNewMacro(Self); 00083 00085 itkTypeMacro(ImageClassifierBase,ClassifierBase); 00086 00088 typedef TInputImage InputImageType; 00089 typedef typename TInputImage::Pointer InputImagePointer; 00090 typedef typename TInputImage::ConstPointer InputImageConstPointer; 00091 00093 typedef typename TClassifiedImage::Pointer ClassifiedImagePointer; 00094 00098 typedef typename Superclass::MeasurementVectorType MeasurementVectorType; 00099 00101 typedef typename Superclass::MembershipFunctionType MembershipFunctionType; 00102 00103 typedef typename Superclass::MembershipFunctionPointer 00104 MembershipFunctionPointer; 00105 00106 typedef typename Superclass::MembershipFunctionPointerVector 00107 MembershipFunctionPointerVector; 00108 00110 typedef typename Superclass::DecisionRuleType DecisionRuleType; 00111 00113 itkSetConstObjectMacro(InputImage,InputImageType ); 00114 00116 itkGetConstObjectMacro(InputImage,InputImageType); 00117 00119 itkSetMacro(ClassifiedImage,ClassifiedImagePointer); 00120 00122 itkGetConstMacro(ClassifiedImage,ClassifiedImagePointer); 00123 00126 typedef typename TInputImage::PixelType InputImagePixelType; 00127 00130 typedef typename TClassifiedImage::PixelType ClassifiedImagePixelType; 00131 00133 typedef 00134 ImageRegionConstIterator< TInputImage > InputImageConstIterator; 00135 typedef 00136 ImageRegionIterator< TClassifiedImage > ClassifiedImageIterator; 00137 00139 const std::vector<double> & 00140 GetPixelMembershipValue(const InputImagePixelType inputImagePixel ); 00141 00142 00143 protected: 00144 ImageClassifierBase(); 00145 ~ImageClassifierBase(); 00146 void PrintSelf(std::ostream& os, Indent indent) const; 00147 00149 void Allocate(); 00150 00152 void GenerateData(); 00153 00154 private: 00155 ImageClassifierBase(const Self&); //purposely not implemented 00156 void operator=(const Self&); //purposely not implemented 00157 00158 typedef typename TInputImage::SizeType InputImageSizeType; 00159 00160 InputImageConstPointer m_InputImage; 00161 ClassifiedImagePointer m_ClassifiedImage; 00162 std::vector< double > m_PixelMembershipValue; 00163 00165 virtual void Classify(); 00166 00167 }; // class ImageClassifierBase 00168 00169 } // namespace itk 00170 00171 #ifndef ITK_MANUAL_INSTANTIATION 00172 #include "itkImageClassifierBase.txx" 00173 #endif 00174 00175 #endif 00176