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
21 Program: Insight Segmentation & Registration Toolkit
22 Module: $RCSfile: itkReducedDimBSplineInterpolateImageFunction.h,v $
23 Language: C++
24 Date: $Date: 2009-04-25 12:27:05 $
25 Version: $Revision: 1.24 $
26
27 Copyright (c) Insight Software Consortium. All rights reserved.
28 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
29
30 Portions of this code are covered under the VTK copyright.
31 See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.
32
33 This software is distributed WITHOUT ANY WARRANTY; without even
34 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
35 PURPOSE. See the above copyright notices for more information.
36
37=========================================================================*/
38#ifndef __itkReducedDimensionBSplineInterpolateImageFunction_h
39#define __itkReducedDimensionBSplineInterpolateImageFunction_h
40
41#include <vector>
42
43#include "itkImageLinearIteratorWithIndex.h"
44#include "itkInterpolateImageFunction.h"
45#include "vnl/vnl_matrix.h"
46
48#include "itkConceptChecking.h"
49#include "itkCovariantVector.h"
50
51namespace itk
52{
87template<
88class TImageType,
89class TCoordRep = double,
90class TCoefficientType = double >
92 public InterpolateImageFunction< TImageType, TCoordRep >
93{
94public:
95
98 typedef InterpolateImageFunction< TImageType, TCoordRep > Superclass;
100 typedef SmartPointer< const Self > ConstPointer;
101
103 itkTypeMacro( ReducedDimensionBSplineInterpolateImageFunction, InterpolateImageFunction );
104
106 itkNewMacro( Self );
107
109 typedef typename Superclass::OutputType OutputType;
110
111 using SizeType = typename TImageType::SizeType;
112
114 typedef typename Superclass::InputImageType InputImageType;
115
117 itkStaticConstMacro( ImageDimension, unsigned int, Superclass::ImageDimension );
118
120 typedef typename Superclass::IndexType IndexType;
121
123 typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
124
126 typedef typename Superclass::PointType PointType;
127
129 typedef ImageLinearIteratorWithIndex< TImageType > Iterator;
130
132 typedef TCoefficientType CoefficientDataType;
133 typedef Image< CoefficientDataType,
134 itkGetStaticConstMacro( ImageDimension )
136
140
142
152 const ContinuousIndexType & index ) const override;
153
155 typedef CovariantVector< OutputType,
156 itkGetStaticConstMacro( ImageDimension )
158
160 {
162 this->GetInputImage()->TransformPhysicalPointToContinuousIndex( point, index );
163 return ( this->EvaluateDerivativeAtContinuousIndex( index ) );
164 }
165
166
168 const ContinuousIndexType & x ) const;
169
172 void SetSplineOrder( unsigned int SplineOrder );
173
174 itkGetConstMacro( SplineOrder, int );
175
177 void SetInputImage( const TImageType * inputData ) override;
178
191 itkSetMacro( UseImageDirection, bool );
192 itkGetConstMacro( UseImageDirection, bool );
193 itkBooleanMacro( UseImageDirection );
194
195protected:
196
199 void PrintSelf( std::ostream & os, Indent indent ) const override;
200
201 // These are needed by the smoothing spline routine.
202 std::vector< CoefficientDataType > m_Scratch; // temp storage for processing of Coefficients
203 typename TImageType::SizeType m_DataLength; // Image size
204 unsigned int m_SplineOrder; // User specified spline order (3rd or cubic is the default)
205
206 typename CoefficientImageType::ConstPointer m_Coefficients; // Spline coefficients
207
208private:
209
210 ReducedDimensionBSplineInterpolateImageFunction( const Self & ); //purposely not implemented
211 void operator=( const Self & ); //purposely not implemented
212
213 SizeType GetRadius() const override
214 {
215 return SizeType::Filled(m_SplineOrder + 1);
216 }
217
220 const vnl_matrix< long > & EvaluateIndex,
221 vnl_matrix< double > & weights,
222 unsigned int splineOrder ) const;
223
226 const vnl_matrix< long > & EvaluateIndex,
227 vnl_matrix< double > & weights,
228 unsigned int splineOrder ) const;
229
233
235 void DetermineRegionOfSupport( vnl_matrix< long > & evaluateIndex,
236 const ContinuousIndexType & x,
237 unsigned int splineOrder ) const;
238
241 void ApplyMirrorBoundaryConditions( vnl_matrix< long > & evaluateIndex,
242 unsigned int splineOrder ) const;
243
244 Iterator m_CIterator; // Iterator for traversing spline coefficients.
245 unsigned long m_MaxNumberInterpolationPoints; // number of neighborhood points used for interpolation
246 std::vector< IndexType > m_PointsToIndex; // Preallocation of interpolation neighborhood indicies
247
249
250 // flag to take or not the image direction into account when computing the
251 // derivatives.
253
254};
255
256} // namespace itk
257
258#ifndef ITK_MANUAL_INSTANTIATION
259#include "itkReducedDimensionBSplineInterpolateImageFunction.hxx"
260#endif
261
262#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
Image< CoefficientDataType, itkGetStaticConstMacro(ImageDimension) > CoefficientImageType
CovariantVector< OutputType, itkGetStaticConstMacro(ImageDimension) > CovariantVectorType
void SetInputImage(const TImageType *inputData) override
MultiOrderBSplineDecompositionImageFilter< TImageType, CoefficientImageType > CoefficientFilter
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 1667476801 for elastix by doxygen 1.9.4 elastix logo