STIR  6.2.0
FastErf.h
Go to the documentation of this file.
1 
11 /*
12  Copyright (C) 2022, University College London
13  This file is part of STIR.
14  SPDX-License-Identifier: Apache-2.0
15  See STIR/LICENSE.txt for details
16 */
17 
19 
20 #ifndef __stir_numerics_FastErf__H__
21 # define __stir_numerics_FastErf__H__
22 
23 START_NAMESPACE_STIR
24 
33 class FastErf
34 {
35 private:
37  int _num_samples;
38 
40  double _sampling_period;
41 
42  // //! Used to check if setup has been run before parameter changes
43  // bool _is_setup = false;
44 
46  BSpline::BSplines1DRegularGrid<double, double> _spline;
47 
51  double _maximum_sample_value;
52 
54  std::vector<double> erf_values_vec;
55 
56 public:
57  explicit FastErf(const int num_samples = 1000, const float maximum_sample_value = 5)
58  : _num_samples(num_samples),
59  _maximum_sample_value(maximum_sample_value)
60  {}
61 
63  inline int get_num_samples() const;
65  inline void set_num_samples(int num_samples);
66 
68  inline double get_maximum_sample_value() const;
70  inline void set_maximum_sample_value(double maximum_sample_value);
71 
73  inline void set_up();
74 
80  inline double get_erf_BSplines_interpolation(double xp) const;
81 
86  inline double get_erf_linear_interpolation(double xp) const;
87 
92  inline double get_erf_nearest_neighbour_interpolation(double xp) const;
93 
95  inline const double operator()(const double xp) const;
96 };
97 
98 END_NAMESPACE_STIR
99 
100 # include "stir/numerics/FastErf.inl"
101 
102 #endif // __stir_numerics_FastErf__H__
Implementation of an erf interpolation.
Implementation of the B-Splines Interpolation.