STIR  6.2.0
BSplinesRegularGrid.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2005 - 2009-10-27, Hammersmith Imanet Ltd
3  Copyright (C) 2013, University College London
4  This file is part of STIR.
5 
6  SPDX-License-Identifier: Apache-2.0
7 
8  See STIR/LICENSE.txt for details
9 */
10 #ifndef __stir_numerics_BSplinesRegularGrid__H__
11 #define __stir_numerics_BSplinesRegularGrid__H__
12 
21 #include "stir/Array.h"
22 #include "stir/BasicCoordinate.h"
23 #include "stir/numerics/BSplines.h"
24 START_NAMESPACE_STIR
25 
26 namespace BSpline
27 {
28 
52 template <int num_dimensions, typename out_elemT, typename in_elemT = out_elemT, typename constantsT = in_elemT>
54 {
55 
56 public:
57  // only there for tests
58  Array<num_dimensions, out_elemT> get_coefficients() const { return this->_coeffs; }
59 
61  inline explicit BSplinesRegularGrid(const Array<num_dimensions, in_elemT>& input, const BSplineType& this_type = cubic)
62  {
63  this->set_private_values(this_type);
64  this->set_coef(input);
65  }
66 
70  {
71  this->set_private_values(this_type);
72  this->set_coef(input);
73  }
74 
76 
77  inline explicit BSplinesRegularGrid(const BSplineType& this_type = cubic) { this->set_private_values(this_type); }
78 
80 
82  {
83  this->set_private_values(this_type);
84  }
85 
87  inline ~BSplinesRegularGrid();
88 
90 
95  inline void set_coef(const Array<num_dimensions, in_elemT>& input);
96 
98 
107  inline const out_elemT operator()(const BasicCoordinate<num_dimensions, pos_type>& relative_positions) const;
108 
110 
119  gradient(const BasicCoordinate<num_dimensions, pos_type>& relative_positions) const;
120 
121 private:
122  // variables that store numbers for the spline type
123  // TODO these coefficients and the spline type could/should be integrated into 1 class
130 
131  inline void set_private_values(const BasicCoordinate<num_dimensions, BSplineType>& this_type);
132  inline void set_private_values(const BSplineType& this_type);
133 };
134 
135 } // namespace BSpline
136 
137 END_NAMESPACE_STIR
138 
140 
141 #endif
A class for n-dimensional BSpline interpolation when the input samples are on a regular grid...
Definition: BSplinesRegularGrid.h:53
BSplineType
enum providing constants to define the type of B-Spline used for interpolation
Definition: BSplines.h:37
BSplinesRegularGrid(const Array< num_dimensions, in_elemT > &input, const BasicCoordinate< num_dimensions, BSplineType > &this_type)
constructor given an array of samples and a different spline type for every dimension ...
Definition: BSplinesRegularGrid.h:68
defines the Array class for multi-dimensional (numeric) arrays
BSplinesRegularGrid(const BasicCoordinate< num_dimensions, BSplineType > &this_type)
constructor that only sets a different spline type for every dimension
Definition: BSplinesRegularGrid.h:81
Implementation of the B-Splines Interpolation.
This file declares class stir::BasicCoordinate and some functions acting on stir::BasicCoordinate obj...
BSplinesRegularGrid(const BSplineType &this_type=cubic)
constructor that only sets the spline type
Definition: BSplinesRegularGrid.h:77
Implementation of the basic components and declarations for B-Splines Interpolation.
BSplinesRegularGrid(const Array< num_dimensions, in_elemT > &input, const BSplineType &this_type=cubic)
constructor given an array of samples and the spline type
Definition: BSplinesRegularGrid.h:61