forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkImageBSplineInternals.h
101 lines (86 loc) · 3.53 KB
/
vtkImageBSplineInternals.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*=========================================================================
Program: Visualization Toolkit
Module: vtkImageBSplineInternals.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class vtkImageBSplineInternals
* @brief BSpline code from P. Thevenaz
*
* vtkImageBSplineInternals provides code for image interpolation with
* b-splines of various degrees. This code computes the coefficents
* from the image, and computes the weights for the b-spline kernels.
*
* This class is based on code provided by Philippe Thevenaz of
* EPFL, Lausanne, Switzerland. Please acknowledge his contribution
* by citing the following paper:
* [1] P. Thevenaz, T. Blu, M. Unser, "Interpolation Revisited,"
* IEEE Transactions on Medical Imaging 19(7):739-758, 2000.
*
* The clamped boundary condition (which is the default) is taken
* from code presented in the following paper:
* [2] D. Ruijters, P. Thevenaz,
* "GPU Prefilter for Accurate Cubic B-spline Interpolation,"
* The Computer Journal, doi: 10.1093/comjnl/bxq086, 2010.
*/
#ifndef vtkImageBSplineInternals_h
#define vtkImageBSplineInternals_h
#include "vtkImagingCoreModule.h" // For export macro
#include "vtkSystemIncludes.h"
class VTKIMAGINGCORE_EXPORT vtkImageBSplineInternals
{
public:
/**
* Internal method. Get the poles for spline of given degree.
* Returns zero if an illegal degree is given (allowed range 2 to 9).
* The parameter numPoles will be set to a value between 1 and 4.
*/
static int GetPoleValues(double poles[4], long &numPoles, long degree);
/**
* Internal method. Compute the coefficients for one row of data.
*/
static void ConvertToInterpolationCoefficients(
double data[], long size, long border, double poles[4], long numPoles,
double tol);
//@{
/**
* Internal method. Get interpolation weights for offset w, where
* w is between 0 and 1. You must provide the degree of the spline.
*/
static int GetInterpolationWeights(
double weights[10], double w, long degree);
static int GetInterpolationWeights(
float weights[10], double w, long degree);
//@}
//@{
/**
* Internal method. Interpolate a value from the supplied 3D array
* of coefficients with dimensions width x height x slices.
*/
static int InterpolatedValue(
const double *coeffs, double *value,
long width, long height, long slices, long depth,
double x, double y, double z, long degree, long border);
static int InterpolatedValue(
const float *coeffs, float *value,
long width, long height, long slices, long depth,
double x, double y, double z, long degree, long border);
//@}
protected:
vtkImageBSplineInternals() {}
~vtkImageBSplineInternals() {}
static double InitialCausalCoefficient(
double data[], long size, long border, double pole, double tol);
static double InitialAntiCausalCoefficient(
double data[], long size, long border, double pole, double tol);
private:
vtkImageBSplineInternals(const vtkImageBSplineInternals&) VTK_DELETE_FUNCTION;
void operator=(const vtkImageBSplineInternals&) VTK_DELETE_FUNCTION;
};
#endif
// VTK-HeaderTest-Exclude: vtkImageBSplineInternals.h