STIR  6.3.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/ArrayFwd.h"
32 
33 START_NAMESPACE_STIR
34 
35 template <typename elemT>
36 class Viewgram;
37 template <typename elemT>
38 class RelatedViewgrams;
39 template <typename elemT>
40 class VoxelsOnCartesianGrid;
41 class ProjDataInfo;
42 class ProjDataInfoCylindrical;
43 
74  : public RegisteredParsingObject<ForwardProjectorByBinUsingRayTracing, ForwardProjectorByBin>
75 {
76 public:
78  static const char* const registered_name;
79 
81 
83 
84  ForwardProjectorByBinUsingRayTracing(const shared_ptr<const ProjDataInfo>&,
85  const shared_ptr<const DiscretisedDensity<3, float>>&);
87 
89  void set_up(const shared_ptr<const ProjDataInfo>& proj_data_info_ptr,
90  const shared_ptr<const DiscretisedDensity<3, float>>& density_info_ptr // TODO should be Info only
91  ) override;
92 
93  const DataSymmetriesForViewSegmentNumbers* get_symmetries_used() const override;
94 
95 protected:
98 
99 private:
100  void actual_forward_project(RelatedViewgrams<float>&,
102  const int min_axial_pos_num,
103  const int max_axial_pos_num,
104  const int min_tangential_pos_num,
105  const int max_tangential_pos_num) override;
106 #if 0 // disabled as currently not used. needs to be written in the new style anyway
107  void actual_forward_project(Bin&,
109 #endif
110 
111  // KT 20/06/2001 changed type from 'const DataSymmetriesForViewSegmentNumbers *'
112  shared_ptr<DataSymmetriesForBins_PET_CartesianGrid> symmetries_ptr;
113  /*
114  The version which uses all possible symmetries.
115  Here 0<=view < num_views/4 (= 45 degrees)
116  */
117 
118  void forward_project_all_symmetries(Viewgram<float>& pos_view,
119  Viewgram<float>& neg_view,
120  Viewgram<float>& pos_plus90,
121  Viewgram<float>& neg_plus90,
122  Viewgram<float>& pos_min180,
123  Viewgram<float>& neg_min180,
124  Viewgram<float>& pos_min90,
125  Viewgram<float>& neg_min90,
126  const VoxelsOnCartesianGrid<float>& image,
127  const int min_axial_pos_num,
128  const int max_axial_pos_num,
129  const int min_tangential_pos_num,
130  const int max_tangential_pos_num) const;
131 
132  /*
133  This function projects 4 viewgrams related by symmetry.
134  It will be used for view=0 or 45 degrees
135  (or others if the number of views is not a multiple of 4)
136  Here 0<=view < num_views/2 (= 90 degrees)
137  */
138  void forward_project_view_plus_90_and_delta(Viewgram<float>& pos_view,
139  Viewgram<float>& neg_view,
140  Viewgram<float>& pos_plus90,
141  Viewgram<float>& neg_plus90,
142  const VoxelsOnCartesianGrid<float>& image,
143  const int min_axial_pos_num,
144  const int max_axial_pos_num,
145  const int min_tangential_pos_num,
146  const int max_tangential_pos_num) const;
147  /*
148  This function projects 4 viewgrams related by symmetry.
149  It will be used for view=0 or 45 degrees
150  (or others if the number of views is not a multiple of 4)
151  Here 0<=view < num_views/2 (= 90 degrees)
152  */
153  void forward_project_view_min_180_and_delta(Viewgram<float>& pos_view,
154  Viewgram<float>& neg_view,
155  Viewgram<float>& pos_min180,
156  Viewgram<float>& neg_min180,
157  const VoxelsOnCartesianGrid<float>& image,
158  const int min_axial_pos_num,
159  const int max_axial_pos_num,
160  const int min_tangential_pos_num,
161  const int max_tangential_pos_num) const;
162 
163  /*
164  This function projects 4 viewgrams related by symmetry.
165  It will be used for view=0 or 45 degrees
166  (or others if the number of views is not a multiple of 4)
167  Here 0<=view < num_views/2 (= 90 degrees)
168  */
169  void forward_project_delta(Viewgram<float>& pos_view,
170  Viewgram<float>& neg_view,
171  const VoxelsOnCartesianGrid<float>& image,
172  const int min_axial_pos_num,
173  const int max_axial_pos_num,
174  const int min_tangential_pos_num,
175  const int max_tangential_pos_num) const;
176 
178  void forward_project_all_symmetries_2D(Viewgram<float>& pos_view,
179  Viewgram<float>& pos_plus90,
180  Viewgram<float>& pos_min180,
181  Viewgram<float>& pos_min90,
182  const VoxelsOnCartesianGrid<float>& image,
183  const int min_axial_pos_num,
184  const int max_axial_pos_num,
185  const int min_tangential_pos_num,
186  const int max_tangential_pos_num) const;
187  void forward_project_view_plus_90_2D(Viewgram<float>& pos_view,
188  Viewgram<float>& pos_plus90,
189  const VoxelsOnCartesianGrid<float>& image,
190  const int min_axial_pos_num,
191  const int max_axial_pos_num,
192  const int min_tangential_pos_num,
193  const int max_tangential_pos_num) const;
194  void forward_project_view_min_180_2D(Viewgram<float>& pos_view,
195  Viewgram<float>& pos_min180,
196  const VoxelsOnCartesianGrid<float>& image,
197  const int min_axial_pos_num,
198  const int max_axial_pos_num,
199  const int min_tangential_pos_num,
200  const int max_tangential_pos_num) const;
201  // no symmetries
202  void forward_project_view_2D(Viewgram<float>& pos_view,
203  const VoxelsOnCartesianGrid<float>& image,
204  const int min_axial_pos_num,
205  const int max_axial_pos_num,
206  const int min_tangential_pos_num,
207  const int max_tangential_pos_num) const;
209 
210  template <int symmetry_type>
211  static bool proj_Siddon(Array<4, float>& Projptr,
213  const shared_ptr<const ProjDataInfoCylindrical> proj_data_info_sptr,
214  const float cphi,
215  const float sphi,
216  const float delta,
217  const float s_in_mm,
218  const float R,
219  const int min_ax_pos_num,
220  const int max_ax_pos_num,
221  const float offset,
222  const int num_planes_per_axial_pos,
223  const float axial_pos_to_z_offset,
224  const float norm_factor,
225  const bool restrict_to_cylindrical_FOV);
226 
227  void set_defaults() override;
228  void initialise_keymap() override;
229 };
230 END_NAMESPACE_STIR
231 #endif
This class is used to represent voxelised densities on a cuboid grid (3D).
Definition: FBP3DRPReconstruction.h:43
forward declaration of stir::Array class for multi-dimensional (numeric) arrays
static const char *const registered_name
Name which will be used when parsing a ForwardProjectorByBin object.
Definition: ForwardProjectorByBinUsingRayTracing.h:78
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:73
Import of std::shared_ptr, std::dynamic_pointer_cast and std::static_pointer_cast into the stir names...
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:97
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.