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

itkSumOfSquaresImageFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkSumOfSquaresImageFunction.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-03-03 15:09:43 $
00007   Version:   $Revision: 1.5 $
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 __itkSumOfSquaresImageFunction_h
00018 #define __itkSumOfSquaresImageFunction_h
00019 
00020 #include "itkImageFunction.h"
00021 #include "itkNumericTraits.h"
00022 #include "itkNeighborhood.h"
00023 
00024 namespace itk
00025 {
00026 
00042 template <class TInputImage, class TCoordRep = float >
00043 class ITK_EXPORT SumOfSquaresImageFunction :
00044   public ImageFunction< TInputImage, ITK_TYPENAME NumericTraits<typename TInputImage::PixelType>::RealType,
00045     TCoordRep >
00046 {
00047 public:
00048 
00050   typedef SumOfSquaresImageFunction Self;
00051   typedef ImageFunction<TInputImage, ITK_TYPENAME NumericTraits<typename TInputImage::PixelType>::RealType,
00052     TCoordRep >                     Superclass;
00053   typedef SmartPointer<Self>        Pointer;
00054   typedef SmartPointer<const Self>  ConstPointer;
00055 
00057   itkTypeMacro(SumOfSquaresImageFunction, ImageFunction);
00058 
00060   itkNewMacro(Self);
00061 
00063   typedef TInputImage InputImageType;
00064 
00066   typedef typename Superclass::OutputType OutputType;
00067 
00069   typedef typename Superclass::IndexType IndexType;
00070 
00072   typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
00073 
00075   typedef typename Superclass::PointType PointType;
00076 
00078   itkStaticConstMacro(ImageDimension, unsigned int,
00079                       InputImageType::ImageDimension);
00080 
00082   typedef typename NumericTraits<typename InputImageType::PixelType>::RealType
00083       RealType;
00084 
00086   virtual RealType EvaluateAtIndex( const IndexType& index ) const;
00087 
00089   virtual RealType Evaluate( const PointType& point ) const
00090     { 
00091     IndexType index;
00092     this->ConvertPointToNearestIndex( point, index );
00093     return this->EvaluateAtIndex( index ); 
00094     }
00095   virtual RealType EvaluateAtContinuousIndex( 
00096     const ContinuousIndexType& cindex ) const
00097     { 
00098     IndexType index;
00099     this->ConvertContinuousIndexToNearestIndex( cindex, index );
00100     return this->EvaluateAtIndex( index );
00101     }
00103 
00106   itkGetConstReferenceMacro( NeighborhoodRadius, unsigned int );
00107 
00108   void SetNeighborhoodRadius(unsigned int radius)
00109     {
00110     m_NeighborhoodRadius = radius;
00111 
00112     m_NeighborhoodSize = 1;
00113     long twoRPlus1 = 2*m_NeighborhoodRadius + 1;
00114     for (unsigned int i=0; i < ImageDimension; i++)
00115       {
00116       m_NeighborhoodSize *= twoRPlus1;
00117       }
00118     }
00119 
00120   itkGetConstReferenceMacro(NeighborhoodSize, unsigned int);
00121 
00122 protected:
00123   SumOfSquaresImageFunction();
00124   ~SumOfSquaresImageFunction(){};
00125   void PrintSelf(std::ostream& os, Indent indent) const;
00126 
00127 private:
00128   SumOfSquaresImageFunction( const Self& ); //purposely not implemented
00129   void operator=( const Self& ); //purposely not implemented
00130 
00131   unsigned int m_NeighborhoodRadius;
00132   unsigned int m_NeighborhoodSize;
00133 };
00134 
00135 } // end namespace itk
00136 
00137 // Define instantiation macro for this template.
00138 #define ITK_TEMPLATE_SumOfSquaresImageFunction(_, EXPORT, x, y) namespace itk { \
00139   _(2(class EXPORT SumOfSquaresImageFunction< ITK_TEMPLATE_2 x >)) \
00140   namespace Templates { typedef SumOfSquaresImageFunction< ITK_TEMPLATE_2 x > \
00141                                          SumOfSquaresImageFunction##y; } \
00142   }
00143 
00144 #if ITK_TEMPLATE_EXPLICIT
00145 # include "Templates/itkSumOfSquaresImageFunction+-.h"
00146 #endif
00147 
00148 #if ITK_TEMPLATE_TXX
00149 # include "itkSumOfSquaresImageFunction.txx"
00150 #endif
00151 
00152 
00153 #endif
00154 

Generated at Tue Sep 15 05:06:04 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000