ITK  5.2.0
Insight Toolkit
itkVectorInterpolateImageFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 
46 template <typename TInputImage, typename TCoordRep = double>
47 class ITK_TEMPLATE_EXPORT VectorInterpolateImageFunction
48  : public ImageFunction<TInputImage, typename NumericTraits<typename TInputImage::PixelType>::RealType, TCoordRep>
49 {
50 public:
51  ITK_DISALLOW_COPY_AND_MOVE(VectorInterpolateImageFunction);
52 
54  static constexpr unsigned int Dimension = TInputImage::PixelType::Dimension;
55 
57  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
58 
61  using Superclass =
63 
66 
69 
71  using InputImageType = typename Superclass::InputImageType;
72  using PixelType = typename InputImageType::PixelType;
73  using ValueType = typename PixelType::ValueType;
75 
77  using PointType = typename Superclass::PointType;
78 
80  using IndexType = typename Superclass::IndexType;
81 
83  using ContinuousIndexType = typename Superclass::ContinuousIndexType;
84 
86  using OutputType = typename Superclass::OutputType;
87 
89  using CoordRepType = TCoordRep;
90 
97  Evaluate(const PointType & point) const override
98  {
99  ContinuousIndexType index;
100 
101  this->GetInputImage()->TransformPhysicalPointToContinuousIndex(point, index);
102  return (this->EvaluateAtContinuousIndex(index));
103  }
104 
115  OutputType
116  EvaluateAtContinuousIndex(const ContinuousIndexType & index) const override = 0;
117 
125  OutputType
126  EvaluateAtIndex(const IndexType & index) const override
127  {
128  OutputType output;
129  PixelType input = this->GetInputImage()->GetPixel(index);
131 
132  for (unsigned int k = 0; k < this->GetInputImage()->GetNumberOfComponentsPerPixel(); k++)
133  {
134  output[k] = static_cast<double>(input[k]);
135  }
136  return (output);
137  }
138 
139 protected:
140  VectorInterpolateImageFunction() = default;
141  ~VectorInterpolateImageFunction() override = default;
142  void
143  PrintSelf(std::ostream & os, Indent indent) const override
144  {
145  Superclass::PrintSelf(os, indent);
146  }
147 };
148 } // end namespace itk
149 
150 #endif
itk::VectorInterpolateImageFunction::IndexType
typename Superclass::IndexType IndexType
Definition: itkVectorInterpolateImageFunction.h:80
itkImageFunction.h
itk::VectorInterpolateImageFunction::PointType
typename Superclass::PointType PointType
Definition: itkVectorInterpolateImageFunction.h:77
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::VectorInterpolateImageFunction::Evaluate
OutputType Evaluate(const PointType &point) const override
Definition: itkVectorInterpolateImageFunction.h:97
itk::VectorInterpolateImageFunction::PrintSelf
void PrintSelf(std::ostream &os, Indent indent) const override
Definition: itkVectorInterpolateImageFunction.h:143
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::VectorInterpolateImageFunction
Base class for all vector image interpolators.
Definition: itkVectorInterpolateImageFunction.h:47
itk::VectorInterpolateImageFunction::PixelType
typename InputImageType::PixelType PixelType
Definition: itkVectorInterpolateImageFunction.h:72
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::VectorInterpolateImageFunction::ContinuousIndexType
typename Superclass::ContinuousIndexType ContinuousIndexType
Definition: itkVectorInterpolateImageFunction.h:83
itk::ImageFunction
Evaluates a function of an image at specified position.
Definition: itkImageFunction.h:55
itk::VectorInterpolateImageFunction::InputImageType
typename Superclass::InputImageType InputImageType
Definition: itkVectorInterpolateImageFunction.h:71
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::VectorInterpolateImageFunction::OutputType
typename Superclass::OutputType OutputType
Definition: itkVectorInterpolateImageFunction.h:86
itkFixedArray.h
itk::VectorInterpolateImageFunction::RealType
typename NumericTraits< ValueType >::RealType RealType
Definition: itkVectorInterpolateImageFunction.h:74
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::VectorInterpolateImageFunction::CoordRepType
TCoordRep CoordRepType
Definition: itkVectorInterpolateImageFunction.h:89
itk::NumericTraits::RealType
double RealType
Definition: itkNumericTraits.h:84
itk::VectorInterpolateImageFunction::ValueType
typename PixelType::ValueType ValueType
Definition: itkVectorInterpolateImageFunction.h:73
itk::VectorInterpolateImageFunction::EvaluateAtIndex
OutputType EvaluateAtIndex(const IndexType &index) const override
Definition: itkVectorInterpolateImageFunction.h:126
itk::GTest::TypedefsAndConstructors::Dimension2::Dimension
constexpr unsigned int Dimension
Definition: itkGTestTypedefsAndConstructors.h:44