STIR  6.2.0
ForwardProjectorByBinUsingRayTracing.h
Go to the documentation of this file.
1 //
2 //
14 /*
15  Copyright (C) 2000 PARAPET partners
16  Copyright (C) 2000- 2011, Hammersmith Imanet Ltd
17  This file is part of STIR.
18 
19  SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license
20 
21  See STIR/LICENSE.txt for details
22 */
23 
24 #ifndef __stir_recon_buildblock_ForwardProjectorByBinUsingRayTracing__H__
25 #define __stir_recon_buildblock_ForwardProjectorByBinUsingRayTracing__H__
26 
29 #include "stir/shared_ptr.h"
31 #include "stir/shared_ptr.h"
32 START_NAMESPACE_STIR
33 
34 template <typename elemT>
35 class Viewgram;
36 template <typename elemT>
37 class RelatedViewgrams;
38 template <typename elemT>
39 class VoxelsOnCartesianGrid;
40 template <int num_dimensions, typename elemT>
41 class Array;
42 class ProjDataInfo;
43 class ProjDataInfoCylindrical;
44 
75  : public RegisteredParsingObject<ForwardProjectorByBinUsingRayTracing, ForwardProjectorByBin>
76 {
77 public:
79  static const char* const registered_name;
80 
82 
84 
85  ForwardProjectorByBinUsingRayTracing(const shared_ptr<const ProjDataInfo>&,
86  const shared_ptr<const DiscretisedDensity<3, float>>&);
88 
90  void set_up(const shared_ptr<const ProjDataInfo>& proj_data_info_ptr,
91  const shared_ptr<const DiscretisedDensity<3, float>>& density_info_ptr // TODO should be Info only
92  ) override;
93 
94  const DataSymmetriesForViewSegmentNumbers* get_symmetries_used() const override;
95 
96 protected:
99 
100 private:
101  void actual_forward_project(RelatedViewgrams<float>&,
103  const int min_axial_pos_num,
104  const int max_axial_pos_num,
105  const int min_tangential_pos_num,
106  const int max_tangential_pos_num) override;
107 #if 0 // disabled as currently not used. needs to be written in the new style anyway
108  void actual_forward_project(Bin&,
110 #endif
111 
112  // KT 20/06/2001 changed type from 'const DataSymmetriesForViewSegmentNumbers *'
113  shared_ptr<DataSymmetriesForBins_PET_CartesianGrid> symmetries_ptr;
114  /*
115  The version which uses all possible symmetries.
116  Here 0<=view < num_views/4 (= 45 degrees)
117  */
118 
119  void forward_project_all_symmetries(Viewgram<float>& pos_view,
120  Viewgram<float>& neg_view,
121  Viewgram<float>& pos_plus90,
122  Viewgram<float>& neg_plus90,
123  Viewgram<float>& pos_min180,
124  Viewgram<float>& neg_min180,
125  Viewgram<float>& pos_min90,
126  Viewgram<float>& neg_min90,
127  const VoxelsOnCartesianGrid<float>& image,
128  const int min_axial_pos_num,
129  const int max_axial_pos_num,
130  const int min_tangential_pos_num,
131  const int max_tangential_pos_num) const;
132 
133  /*
134  This function projects 4 viewgrams related by symmetry.
135  It will be used for view=0 or 45 degrees
136  (or others if the number of views is not a multiple of 4)
137  Here 0<=view < num_views/2 (= 90 degrees)
138  */
139  void forward_project_view_plus_90_and_delta(Viewgram<float>& pos_view,
140  Viewgram<float>& neg_view,
141  Viewgram<float>& pos_plus90,
142  Viewgram<float>& neg_plus90,
143  const VoxelsOnCartesianGrid<float>& image,
144  const int min_axial_pos_num,
145  const int max_axial_pos_num,
146  const int min_tangential_pos_num,
147  const int max_tangential_pos_num) const;
148  /*
149  This function projects 4 viewgrams related by symmetry.
150  It will be used for view=0 or 45 degrees
151  (or others if the number of views is not a multiple of 4)
152  Here 0<=view < num_views/2 (= 90 degrees)
153  */
154  void forward_project_view_min_180_and_delta(Viewgram<float>& pos_view,
155  Viewgram<float>& neg_view,
156  Viewgram<float>& pos_min180,
157  Viewgram<float>& neg_min180,
158  const VoxelsOnCartesianGrid<float>& image,
159  const int min_axial_pos_num,
160  const int max_axial_pos_num,
161  const int min_tangential_pos_num,
162  const int max_tangential_pos_num) const;
163 
164  /*
165  This function projects 4 viewgrams related by symmetry.
166  It will be used for view=0 or 45 degrees
167  (or others if the number of views is not a multiple of 4)
168  Here 0<=view < num_views/2 (= 90 degrees)
169  */
170  void forward_project_delta(Viewgram<float>& pos_view,
171  Viewgram<float>& neg_view,
172  const VoxelsOnCartesianGrid<float>& image,
173  const int min_axial_pos_num,
174  const int max_axial_pos_num,
175  const int min_tangential_pos_num,
176  const int max_tangential_pos_num) const;
177 
179  void forward_project_all_symmetries_2D(Viewgram<float>& pos_view,
180  Viewgram<float>& pos_plus90,
181  Viewgram<float>& pos_min180,
182  Viewgram<float>& pos_min90,
183  const VoxelsOnCartesianGrid<float>& image,
184  const int min_axial_pos_num,
185  const int max_axial_pos_num,
186  const int min_tangential_pos_num,
187  const int max_tangential_pos_num) const;
188  void forward_project_view_plus_90_2D(Viewgram<float>& pos_view,
189  Viewgram<float>& pos_plus90,
190  const VoxelsOnCartesianGrid<float>& image,
191  const int min_axial_pos_num,
192  const int max_axial_pos_num,
193  const int min_tangential_pos_num,
194  const int max_tangential_pos_num) const;
195  void forward_project_view_min_180_2D(Viewgram<float>& pos_view,
196  Viewgram<float>& pos_min180,
197  const VoxelsOnCartesianGrid<float>& image,
198  const int min_axial_pos_num,
199  const int max_axial_pos_num,
200  const int min_tangential_pos_num,
201  const int max_tangential_pos_num) const;
202  // no symmetries
203  void forward_project_view_2D(Viewgram<float>& pos_view,
204  const VoxelsOnCartesianGrid<float>& image,
205  const int min_axial_pos_num,
206  const int max_axial_pos_num,
207  const int min_tangential_pos_num,
208  const int max_tangential_pos_num) const;
210 
211  template <int symmetry_type>
212  static bool proj_Siddon(Array<4, float>& Projptr,
214  const shared_ptr<const ProjDataInfoCylindrical> proj_data_info_sptr,
215  const float cphi,
216  const float sphi,
217  const float delta,
218  const float s_in_mm,
219  const float R,
220  const int min_ax_pos_num,
221  const int max_ax_pos_num,
222  const float offset,
223  const int num_planes_per_axial_pos,
224  const float axial_pos_to_z_offset,
225  const float norm_factor,
226  const bool restrict_to_cylindrical_FOV);
227 
228  void set_defaults() override;
229  void initialise_keymap() override;
230 };
231 END_NAMESPACE_STIR
232 #endif
This class is used to represent voxelised densities on a cuboid grid (3D).
Definition: FBP3DRPReconstruction.h:43
static const char *const registered_name
Name which will be used when parsing a ForwardProjectorByBin object.
Definition: ForwardProjectorByBinUsingRayTracing.h:79
This class implements forward projection using Siddon&#39;s algorithm for ray tracing. That is, it computes length of intersection with the voxels.
Definition: ForwardProjectorByBinUsingRayTracing.h:74
Import of std::shared_ptr, std::dynamic_pointer_cast and std::static_pointer_cast (or corresponding b...
A class for encoding/finding symmetries. Works only on ViewSegmentNumbers (instead of Bin)...
Definition: DataSymmetriesForViewSegmentNumbers.h:49
Declaration of class stir::DataSymmetriesForBins_PET_CartesianGrid.
bool restrict_to_cylindrical_FOV
variable that determines if a cylindrical FOV or the whole image will be handled
Definition: ForwardProjectorByBinUsingRayTracing.h:98
A class for storing coordinates and value of a single projection bin.
Definition: Bin.h:48
Parent class for all leaves in a RegisteredObject hierarchy that do parsing of parameter files...
Definition: RegisteredParsingObject.h:77
Base class for forward projectors which work on &#39;large&#39; collections of bins: given the whole image...
Declaration of class stir::RegisteredParsingObject.