ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkVectorNearestNeighborInterpolateImageFunction.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 __itkVectorNearestNeighborInterpolateImageFunction_h
00019 #define __itkVectorNearestNeighborInterpolateImageFunction_h
00020 
00021 #include "itkVectorInterpolateImageFunction.h"
00022 
00023 namespace itk
00024 {
00042 template< class TInputImage, class TCoordRep = double >
00043 class ITK_EXPORT VectorNearestNeighborInterpolateImageFunction:
00044   public VectorInterpolateImageFunction< TInputImage, TCoordRep >
00045 {
00046 public:
00047 
00049   typedef VectorNearestNeighborInterpolateImageFunction            Self;
00050   typedef VectorInterpolateImageFunction< TInputImage, TCoordRep > Superclass;
00051   typedef SmartPointer< Self >                                     Pointer;
00052   typedef SmartPointer< const Self >                               ConstPointer;
00053 
00055   itkNewMacro(Self);
00056 
00058   itkTypeMacro(VectorNearestNeighborInterpolateImageFunction,
00059                VectorInterpolateImageFunction);
00060 
00062   typedef typename Superclass::InputImageType InputImageType;
00063   typedef typename Superclass::PixelType      PixelType;
00064   typedef typename Superclass::ValueType      ValueType;
00065   typedef typename Superclass::RealType       RealType;
00066 
00068   itkStaticConstMacro(Dimension, unsigned int,
00069                       Superclass::Dimension);
00070 
00072   itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
00073 
00075   typedef typename Superclass::IndexType IndexType;
00076 
00078   typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
00079 
00081   typedef typename Superclass::OutputType OutputType;
00082 
00091   virtual OutputType EvaluateAtContinuousIndex(
00092     const ContinuousIndexType & index) const
00093   {
00094     IndexType nindex;
00095 
00096     this->ConvertContinuousIndexToNearestIndex(index, nindex);
00097     return static_cast< OutputType >( this->GetInputImage()->GetPixel(nindex) );
00098   }
00099 
00100 protected:
00101   VectorNearestNeighborInterpolateImageFunction(){}
00102   ~VectorNearestNeighborInterpolateImageFunction(){}
00103   void PrintSelf(std::ostream & os, Indent indent) const
00104   { Superclass::PrintSelf(os, indent); }
00105 private:
00106   VectorNearestNeighborInterpolateImageFunction(const Self &); //purposely not
00107                                                                // implemented
00108   void operator=(const Self &);                                //purposely not
00109                                                                // implemented
00110 };
00111 } // end namespace itk
00112 
00113 #endif
00114