ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkVectorMeanImageFunction.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 __itkVectorMeanImageFunction_h
00019 #define __itkVectorMeanImageFunction_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 VectorMeanImageFunction:
00046   public ImageFunction< TInputImage,
00047                         typename NumericTraits< typename TInputImage::PixelType >::RealType,
00048                         TCoordRep >
00049 {
00050 public:
00051 
00053   typedef VectorMeanImageFunction Self;
00054   typedef ImageFunction< TInputImage,
00055                          typename NumericTraits< typename TInputImage::PixelType >::RealType,
00056                          TCoordRep >                     Superclass;
00057 
00058   typedef SmartPointer< Self >       Pointer;
00059   typedef SmartPointer< const Self > ConstPointer;
00060 
00062   itkTypeMacro(VectorMeanImageFunction, ImageFunction);
00063 
00065   itkNewMacro(Self);
00066 
00068   typedef TInputImage InputImageType;
00069 
00071   typedef typename Superclass::OutputType OutputType;
00072 
00074   typedef typename Superclass::IndexType IndexType;
00075 
00077   typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
00078 
00080   typedef typename Superclass::PointType PointType;
00081 
00083   itkStaticConstMacro(ImageDimension, unsigned int,
00084                       InputImageType::ImageDimension);
00085 
00087   typedef typename NumericTraits< typename TInputImage::PixelType >::RealType RealType;
00088 
00090   virtual RealType EvaluateAtIndex(const IndexType & index) const;
00091 
00093   virtual RealType Evaluate(const PointType & point) const
00094   {
00095     IndexType index;
00096 
00097     this->ConvertPointToNearestIndex(point, index);
00098     return this->EvaluateAtIndex(index);
00099   }
00100 
00101   virtual RealType EvaluateAtContinuousIndex(
00102     const ContinuousIndexType & cindex) const
00103   {
00104     IndexType index;
00105 
00106     this->ConvertContinuousIndexToNearestIndex(cindex, index);
00107     return this->EvaluateAtIndex(index);
00108   }
00109 
00112   itkSetMacro(NeighborhoodRadius, unsigned int);
00113   itkGetConstReferenceMacro(NeighborhoodRadius, unsigned int);
00114 protected:
00115   VectorMeanImageFunction();
00116   ~VectorMeanImageFunction(){}
00117   void PrintSelf(std::ostream & os, Indent indent) const;
00119 
00120 private:
00121   VectorMeanImageFunction(const Self &); //purposely not implemented
00122   void operator=(const Self &);          //purposely not implemented
00123 
00124   unsigned int m_NeighborhoodRadius;
00125 };
00126 } // end namespace itk
00127 
00128 // Define instantiation macro for this template.
00129 #define ITK_TEMPLATE_VectorMeanImageFunction(_, EXPORT, TypeX, TypeY)     \
00130   namespace itk                                                           \
00131   {                                                                       \
00132   _( 2 ( class EXPORT VectorMeanImageFunction< ITK_TEMPLATE_2 TypeX > ) ) \
00133   namespace Templates                                                     \
00134   {                                                                       \
00135   typedef VectorMeanImageFunction< ITK_TEMPLATE_2 TypeX >                 \
00136   VectorMeanImageFunction##TypeY;                                       \
00137   }                                                                       \
00138   }
00139 
00140 #if ITK_TEMPLATE_EXPLICIT
00141 #include "Templates/itkVectorMeanImageFunction+-.h"
00142 #endif
00143 
00144 #if ITK_TEMPLATE_TXX
00145 #include "itkVectorMeanImageFunction.hxx"
00146 #endif
00147 
00148 #endif
00149