go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkReducedDimensionBSplineInterpolateImageFunction.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright UMC Utrecht and contributors
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/*=========================================================================
19
20 Program: Insight Segmentation & Registration Toolkit
21 Module: $RCSfile: itkReducedDimBSplineInterpolateImageFunction.h,v $
22 Date: $Date: 2009-04-25 12:27:05 $
23 Version: $Revision: 1.24 $
24
25 Copyright (c) Insight Software Consortium. All rights reserved.
26 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
27
28 Portions of this code are covered under the VTK copyright.
29 See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.
30
31 This software is distributed WITHOUT ANY WARRANTY; without even
32 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
33 PURPOSE. See the above copyright notices for more information.
34
35=========================================================================*/
36#ifndef itkReducedDimensionBSplineInterpolateImageFunction_h
37#define itkReducedDimensionBSplineInterpolateImageFunction_h
38
39#include <vector>
40
41#include "itkInterpolateImageFunction.h"
42#include <vnl/vnl_matrix.h>
43
45#include "itkConceptChecking.h"
46#include "itkCovariantVector.h"
47
48namespace itk
49{
84template <class TImageType, class TCoordRep = double, class TCoefficientType = double>
86 : public InterpolateImageFunction<TImageType, TCoordRep>
87{
88public:
90
93 using Superclass = InterpolateImageFunction<TImageType, TCoordRep>;
94 using Pointer = SmartPointer<Self>;
95 using ConstPointer = SmartPointer<const Self>;
96
98 itkTypeMacro(ReducedDimensionBSplineInterpolateImageFunction, InterpolateImageFunction);
99
101 itkNewMacro(Self);
102
104 using typename Superclass::OutputType;
105
106 using SizeType = typename TImageType::SizeType;
107
109 using typename Superclass::InputImageType;
110
112 itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
113
115 using typename Superclass::IndexType;
116
118 using typename Superclass::ContinuousIndexType;
119
121 using typename Superclass::PointType;
122
124 using CoefficientDataType = TCoefficientType;
126
129
131
140 OutputType
141 EvaluateAtContinuousIndex(const ContinuousIndexType & index) const override;
142
144 using CovariantVectorType = CovariantVector<OutputType, Self::ImageDimension>;
145
147 EvaluateDerivative(const PointType & point) const
148 {
149 const auto index = this->GetInputImage()->template TransformPhysicalPointToContinuousIndex<TCoordRep>(point);
150 return (this->EvaluateDerivativeAtContinuousIndex(index));
151 }
152
153
154 CovariantVectorType
155 EvaluateDerivativeAtContinuousIndex(const ContinuousIndexType & x) const;
156
159 void
160 SetSplineOrder(unsigned int SplineOrder);
161
162 itkGetConstMacro(SplineOrder, int);
163
165 void
166 SetInputImage(const TImageType * inputData) override;
167
180 itkSetMacro(UseImageDirection, bool);
181 itkGetConstMacro(UseImageDirection, bool);
182 itkBooleanMacro(UseImageDirection);
183
184protected:
187 void
188 PrintSelf(std::ostream & os, Indent indent) const override;
189
190 // These are needed by the smoothing spline routine.
191 typename TImageType::SizeType m_DataLength{}; // Image size
192 unsigned int m_SplineOrder{}; // User specified spline order (3rd or cubic is the default)
193
194 typename CoefficientImageType::ConstPointer m_Coefficients{}; // Spline coefficients
195
196private:
197 SizeType
198 GetRadius() const override
199 {
200 return SizeType::Filled(m_SplineOrder + 1);
201 }
202
204 void
205 SetInterpolationWeights(const ContinuousIndexType & x,
206 const vnl_matrix<long> & EvaluateIndex,
207 vnl_matrix<double> & weights,
208 unsigned int splineOrder) const;
209
211 void
212 SetDerivativeWeights(const ContinuousIndexType & x,
213 const vnl_matrix<long> & EvaluateIndex,
214 vnl_matrix<double> & weights,
215 unsigned int splineOrder) const;
216
219 void
221
223 void
224 DetermineRegionOfSupport(vnl_matrix<long> & evaluateIndex,
225 const ContinuousIndexType & x,
226 unsigned int splineOrder) const;
227
230 void
231 ApplyMirrorBoundaryConditions(vnl_matrix<long> & evaluateIndex, unsigned int splineOrder) const;
232
233 std::vector<IndexType> m_PointsToIndex{}; // Preallocation of interpolation neighborhood indicies
234
235 CoefficientFilterPointer m_CoefficientFilter{};
236
237 // flag to take or not the image direction into account when computing the
238 // derivatives.
239 bool m_UseImageDirection{};
240};
241
242} // namespace itk
243
244#ifndef ITK_MANUAL_INSTANTIATION
245# include "itkReducedDimensionBSplineInterpolateImageFunction.hxx"
246#endif
247
248#endif
Calculates the B-Spline coefficients of an image. Spline order may be per dimension from 0 to 5 per.
Evaluates the B-Spline interpolation of an image. Spline order may be from 0 to 5.
OutputType EvaluateAtContinuousIndex(const ContinuousIndexType &index) const override
ITK_DISALLOW_COPY_AND_MOVE(ReducedDimensionBSplineInterpolateImageFunction)
void SetInputImage(const TImageType *inputData) override
void SetDerivativeWeights(const ContinuousIndexType &x, const vnl_matrix< long > &EvaluateIndex, vnl_matrix< double > &weights, unsigned int splineOrder) const
void DetermineRegionOfSupport(vnl_matrix< long > &evaluateIndex, const ContinuousIndexType &x, unsigned int splineOrder) const
void ApplyMirrorBoundaryConditions(vnl_matrix< long > &evaluateIndex, unsigned int splineOrder) const
itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension)
CovariantVectorType EvaluateDerivativeAtContinuousIndex(const ContinuousIndexType &x) const
void SetInterpolationWeights(const ContinuousIndexType &x, const vnl_matrix< long > &EvaluateIndex, vnl_matrix< double > &weights, unsigned int splineOrder) const
void PrintSelf(std::ostream &os, Indent indent) const override


Generated on 2024-07-17 for elastix by doxygen 1.11.0 (9b424b03c9833626cd435af22a444888fbbb192d) elastix logo