22template <
class elemT,
class positionT>
30 && nearest_neighbour[2] <= in[nearest_neighbour[1]].
get_max_index()
31 && nearest_neighbour[2] >= in[nearest_neighbour[1]].
get_min_index()
32 && nearest_neighbour[3] <= in[nearest_neighbour[1]][nearest_neighbour[2]].
get_max_index()
33 && nearest_neighbour[3] >= in[nearest_neighbour[1]][nearest_neighbour[2]].
get_min_index())
35 return in[nearest_neighbour];
41template <
int num_dimensions,
class elemT,
class positionT,
class valueT>
52 && nearest_neighbour[2] <= out[nearest_neighbour[1]].
get_max_index()
53 && nearest_neighbour[2] >= out[nearest_neighbour[1]].
get_min_index()
54 && nearest_neighbour[3] <= out[nearest_neighbour[1]][nearest_neighbour[2]].
get_max_index()
55 && nearest_neighbour[3] >= out[nearest_neighbour[1]][nearest_neighbour[2]].
get_min_index())
56 out[nearest_neighbour] +=
static_cast<elemT
>(value);
59template <
class elemT,
class positionT>
65 round(std::floor(point_in_input_coords[2])),
66 round(std::floor(point_in_input_coords[3])));
71 && left_neighbour[3] < in[left_neighbour[1]][left_neighbour[2]].
get_max_index()
72 && left_neighbour[3] >= in[left_neighbour[1]][left_neighbour[2]].
get_min_index())
74 const int x1 = left_neighbour[3];
75 const int y1 = left_neighbour[2];
76 const int z1 = left_neighbour[1];
77 const int x2 = left_neighbour[3] + 1;
78 const int y2 = left_neighbour[2] + 1;
79 const int z2 = left_neighbour[1] + 1;
80 const positionT ix = point_in_input_coords[3] - x1;
81 const positionT iy = point_in_input_coords[2] - y1;
82 const positionT iz = point_in_input_coords[1] - z1;
83 const positionT ixc = 1 - ix;
84 const positionT iyc = 1 - iy;
85 const positionT izc = 1 - iz;
86 return static_cast<elemT
>(
87 ixc * (iyc * (izc * in[z1][y1][x1] + iz * in[z2][y1][x1]) + iy * (izc * in[z1][y2][x1] + iz * in[z2][y2][x1]))
88 + ix * (iyc * (izc * in[z1][y1][x2] + iz * in[z2][y1][x2]) + iy * (izc * in[z1][y2][x2] + iz * in[z2][y2][x2])));
94template <
class elemT,
class positionT,
class valueT>
102 round(std::floor(point_in_output_coords[2])),
103 round(std::floor(point_in_output_coords[3])));
108 && left_neighbour[3] < out[left_neighbour[1]][left_neighbour[2]].
get_max_index()
109 && left_neighbour[3] >= out[left_neighbour[1]][left_neighbour[2]].
get_min_index())
111 const int x1 = left_neighbour[3];
112 const int y1 = left_neighbour[2];
113 const int z1 = left_neighbour[1];
114 const int x2 = left_neighbour[3] + 1;
115 const int y2 = left_neighbour[2] + 1;
116 const int z2 = left_neighbour[1] + 1;
117 const float ix = point_in_output_coords[3] - x1;
118 const float iy = point_in_output_coords[2] - y1;
119 const float iz = point_in_output_coords[1] - z1;
120 const float ixc = 1 - ix;
121 const float iyc = 1 - iy;
122 const float izc = 1 - iz;
123 out[z1][y1][x1] += ixc * iyc * izc * value;
124 out[z2][y1][x1] += ixc * iyc * iz * value;
125 out[z1][y2][x1] += ixc * iy * izc * value;
126 out[z2][y2][x1] += ixc * iy * iz * value;
127 out[z1][y1][x2] += ix * iyc * izc * value;
128 out[z2][y1][x2] += ix * iyc * iz * value;
129 out[z1][y2][x2] += ix * iy * izc * value;
130 out[z2][y2][x2] += ix * iy * iz * value;
defines the stir::Array class for multi-dimensional (numeric) arrays
defines the stir::Coordinate3D<coordT> class
This class defines multi-dimensional (numeric) arrays.
Definition Array.h:78
class BasicCoordinate<int num_dimensions, typename coordT> defines num_dimensions -dimensional coordi...
Definition BasicCoordinate.h:57
a templated class for 3-dimensional coordinates.
Definition Coordinate3D.h:43
int get_max_index() const
get value of last valid index
Definition VectorWithOffset.inl:131
int get_min_index() const
get value of first valid index
Definition VectorWithOffset.inl:124
elemT pull_linear_interpolate(const Array< 3, elemT > &in, const BasicCoordinate< 3, positionT > &point_in_input_coords)
Returns an interpolated value according to point_in_input_coords.
Definition more_interpolators.inl:61
void push_transpose_linear_interpolate(Array< 3, elemT > &out, const BasicCoordinate< 3, positionT > &point_in_output_coords, valueT value)
Push value into the output array using the transpose of linear interpolation.
Definition more_interpolators.inl:96
void push_nearest_neighbour_interpolate(Array< num_dimensions, elemT > &out, const BasicCoordinate< num_dimensions, positionT > &point_in_output_coords, valueT value)
Push value into the output array using nearest neigbour interpolation.
Definition more_interpolators.inl:43
elemT pull_nearest_neighbour_interpolate(const Array< 3, elemT > &in, const BasicCoordinate< 3, positionT > &point_in_input_coords)
Pull value from the input array using nearest neigbour interpolation.
Definition more_interpolators.inl:24
int round(const float x)
Implements rounding of floating point numbers.
Definition round.inl:59
Declaration of the stir::round functions.