ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkCovarianceImageFunction.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 __itkCovarianceImageFunction_h
00019 #define __itkCovarianceImageFunction_h
00020 
00021 #include "itkImageFunction.h"
00022 #include "itkNumericTraits.h"
00023 
00024 namespace itk
00025 {
00044 template< class TInputImage, class TCoordRep = float >
00045 class ITK_EXPORT CovarianceImageFunction:
00046   public ImageFunction< TInputImage,
00047                         vnl_matrix<
00048                           typename NumericTraits< typename TInputImage::PixelType::ValueType >::RealType >,
00049                         TCoordRep >
00050 {
00051 public:
00052 
00054   typedef CovarianceImageFunction Self;
00055   typedef ImageFunction< TInputImage,
00056                          vnl_matrix<
00057                            typename NumericTraits< typename TInputImage::PixelType::ValueType >::RealType >,
00058                          TCoordRep >                     Superclass;
00059 
00060   typedef SmartPointer< Self >       Pointer;
00061   typedef SmartPointer< const Self > ConstPointer;
00062 
00064   itkTypeMacro(CovarianceImageFunction, ImageFunction);
00065 
00067   itkNewMacro(Self);
00068 
00070   typedef TInputImage InputImageType;
00071 
00073   typedef typename Superclass::OutputType OutputType;
00074 
00076   typedef typename Superclass::IndexType IndexType;
00077 
00079   typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
00080 
00082   typedef typename Superclass::PointType PointType;
00083 
00085   itkStaticConstMacro(ImageDimension, unsigned int,
00086                       InputImageType::ImageDimension);
00087 
00089   typedef vnl_matrix<
00090     typename NumericTraits< typename InputImageType::PixelType::ValueType >::RealType >
00091   RealType;
00092 
00094   virtual RealType EvaluateAtIndex(const IndexType & index) const;
00095 
00097   virtual RealType Evaluate(const PointType & point) const
00098   {
00099     IndexType index;
00100 
00101     this->ConvertPointToNearestIndex(point, index);
00102     return this->EvaluateAtIndex(index);
00103   }
00104 
00105   virtual RealType EvaluateAtContinuousIndex(
00106     const ContinuousIndexType & cindex) const
00107   {
00108     IndexType index;
00109 
00110     this->ConvertContinuousIndexToNearestIndex(cindex, index);
00111     return this->EvaluateAtIndex(index);
00112   }
00113 
00116   itkSetMacro(NeighborhoodRadius, unsigned int);
00117   itkGetConstReferenceMacro(NeighborhoodRadius, unsigned int);
00118 protected:
00119   CovarianceImageFunction();
00120   ~CovarianceImageFunction(){}
00121   void PrintSelf(std::ostream & os, Indent indent) const;
00123 
00124 private:
00125   CovarianceImageFunction(const Self &); //purposely not implemented
00126   void operator=(const Self &);          //purposely not implemented
00127 
00128   unsigned int m_NeighborhoodRadius;
00129 };
00130 } // end namespace itk
00131 
00132 // Define instantiation macro for this template.
00133 #define ITK_TEMPLATE_CovarianceImageFunction(_, EXPORT, TypeX, TypeY)     \
00134   namespace itk                                                           \
00135   {                                                                       \
00136   _( 2 ( class EXPORT CovarianceImageFunction< ITK_TEMPLATE_2 TypeX > ) ) \
00137   namespace Templates                                                     \
00138   {                                                                       \
00139   typedef CovarianceImageFunction< ITK_TEMPLATE_2 TypeX >                 \
00140   CovarianceImageFunction##TypeY;                                       \
00141   }                                                                       \
00142   }
00143 
00144 #if ITK_TEMPLATE_EXPLICIT
00145 #include "Templates/itkCovarianceImageFunction+-.h"
00146 #endif
00147 
00148 #if ITK_TEMPLATE_TXX
00149 #include "itkCovarianceImageFunction.hxx"
00150 #endif
00151 
00152 #endif
00153