ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkVectorInterpolateImageFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkVectorInterpolateImageFunction_h
19 #define itkVectorInterpolateImageFunction_h
20 
21 #include "itkImageFunction.h"
22 #include "itkFixedArray.h"
23 
24 namespace itk
25 {
26 
45 template< typename TInputImage, typename TCoordRep = double >
46 class ITK_TEMPLATE_EXPORT VectorInterpolateImageFunction:
47  public ImageFunction<
48  TInputImage,
49  typename NumericTraits< typename TInputImage::PixelType >::RealType,
50  TCoordRep >
51 {
52 public:
54  itkStaticConstMacro(Dimension, unsigned int,
56 
58  itkStaticConstMacro(ImageDimension, unsigned int,
59  TInputImage::ImageDimension);
60 
63  typedef ImageFunction< TInputImage,
65  TCoordRep > Superclass;
66 
69 
72 
74  typedef typename Superclass::InputImageType InputImageType;
75  typedef typename InputImageType::PixelType PixelType;
76  typedef typename PixelType::ValueType ValueType;
78 
80  typedef typename Superclass::PointType PointType;
81 
83  typedef typename Superclass::IndexType IndexType;
84 
86  typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
87 
89  typedef typename Superclass::OutputType OutputType;
90 
92  typedef TCoordRep CoordRepType;
93 
99  virtual OutputType Evaluate(const PointType & point) const ITK_OVERRIDE
100  {
101  ContinuousIndexType index;
102 
103  this->GetInputImage()->TransformPhysicalPointToContinuousIndex(point, index);
104  return ( this->EvaluateAtContinuousIndex(index) );
105  }
106 
117  virtual OutputType EvaluateAtContinuousIndex(
118  const ContinuousIndexType & index) const ITK_OVERRIDE = 0;
119 
127  virtual OutputType EvaluateAtIndex(const IndexType & index) const ITK_OVERRIDE
128  {
129  OutputType output;
130  PixelType input = this->GetInputImage()->GetPixel(index);
132 
133  for ( unsigned int k = 0;
134  k < this->GetInputImage()->GetNumberOfComponentsPerPixel(); k++ )
135  {
136  output[k] = static_cast< double >( input[k] );
137  }
138  return ( output );
139  }
140 
141 protected:
144  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE
145  { Superclass::PrintSelf(os, indent); }
146 
147 private:
148  ITK_DISALLOW_COPY_AND_ASSIGN(VectorInterpolateImageFunction);
149 };
150 } // end namespace itk
151 
152 #endif
Superclass::ContinuousIndexType ContinuousIndexType
virtual OutputType Evaluate(const PointType &point) const override
virtual OutputType EvaluateAtIndex(const IndexType &index) const override
NumericTraits< ValueType >::RealType RealType
void PrintSelf(std::ostream &os, Indent indent) const override
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for all vector image interpolaters.
ImageFunction< TInputImage, typename NumericTraits< typename TInputImage::PixelType >::RealType, TCoordRep > Superclass
Evaluates a function of an image at specified position.