ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkImageClassifierBase.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkImageClassifierBase_h
00019 #define __itkImageClassifierBase_h
00020 
00021 #include "itkClassifierBase.h"
00022 #include "itkMacro.h"
00023 #include "itkImageRegionIterator.h"
00024 
00025 namespace itk
00026 {
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   std::vector< double >
00140   GetPixelMembershipValue(const InputImagePixelType inputImagePixel);
00141 
00142 protected:
00143   ImageClassifierBase();
00144   ~ImageClassifierBase();
00145   void PrintSelf(std::ostream & os, Indent indent) const;
00146 
00148   void Allocate();
00149 
00151   void GenerateData();
00152 
00153 private:
00154   ImageClassifierBase(const Self &); //purposely not implemented
00155   void operator=(const Self &);      //purposely not implemented
00156 
00157   typedef typename TInputImage::SizeType InputImageSizeType;
00158 
00159   InputImageConstPointer m_InputImage;
00160   ClassifiedImagePointer m_ClassifiedImage;
00161 
00163   virtual void Classify();
00164 }; // class ImageClassifierBase
00165 } // namespace itk
00166 
00167 #ifndef ITK_MANUAL_INSTANTIATION
00168 #include "itkImageClassifierBase.hxx"
00169 #endif
00170 
00171 #endif
00172