STIR  6.2.0
ProjMatrixByBinUsingInterpolation.h
Go to the documentation of this file.
1 //
2 //
3 /*
4  Copyright (C) 2000- 2008, Hammersmith Imanet Ltd
5  This file is part of STIR.
6 
7  SPDX-License-Identifier: Apache-2.0
8 
9  See STIR/LICENSE.txt for details
10 */
20 #ifndef __stir_recon_buildblock_ProjMatrixByBinUsingInterpolation__
21 #define __stir_recon_buildblock_ProjMatrixByBinUsingInterpolation__
22 
27 #include "stir/shared_ptr.h"
28 
29 START_NAMESPACE_STIR
30 
31 template <int num_dimensions, typename elemT>
32 class DiscretisedDensity;
33 class Bin;
51  : public RegisteredParsingObject<ProjMatrixByBinUsingInterpolation, ProjMatrixByBin, ProjMatrixByBin>
52 {
53 public:
55  static const char* const registered_name;
56 
59 
61 
63  void set_up(const shared_ptr<const ProjDataInfo>& proj_data_info_ptr,
64  const shared_ptr<const DiscretisedDensity<3, float>>& density_info_ptr // TODO should be Info only
65  ) override;
66 
67  ProjMatrixByBinUsingInterpolation* clone() const override;
68 
69 private:
70  bool do_symmetry_90degrees_min_phi;
71  bool do_symmetry_180degrees_min_phi;
72  bool do_symmetry_swap_segment;
73  bool do_symmetry_swap_s;
74  bool do_symmetry_shift_z;
75 
76  // explicitly list necessary members for image details (should use an Info object instead)
79  IndexRange<3> densel_range;
80 
81  shared_ptr<const ProjDataInfo> proj_data_info_ptr;
82 
83  // for Jacobian
84  const ProjDataInfoCylindrical& proj_data_info_cyl() const
85  {
86  return static_cast<const ProjDataInfoCylindrical&>(*proj_data_info_ptr);
87  }
104  class JacobianForIntBP
105  {
106  private:
107  // store some scanner related data to avoid recomputation
108  float R2;
109  float ring_spacing2;
110  bool arccor;
111  // total normalisation of backprojection, 3 factors:
112  // (_Pi/scanner.num_views) for discretisation of integral over phi
113  // scanner.ring_spacing for discretisation of integral over delta
114  // normalisation of projection space integral: 1/(2 Pi)
115 
116  float backprojection_normalisation;
117 
118  bool use_exact_Jacobian_now;
119 
120  public:
121  // default constructor needed as now member of projector class (better to make set_up)
122  JacobianForIntBP() {}
123  explicit JacobianForIntBP(const ProjDataInfoCylindrical* proj_data_info_ptr, bool exact);
124  // s in mm here!
125  float operator()(const float delta, const float s) const
126  {
127  float tmp;
128  if (use_exact_Jacobian_now)
129  tmp = 4 * (R2 - s * s);
130  else
131  tmp = 4 * R2;
132  if (!arccor)
133  tmp *= sqrt(tmp);
134  return (arccor ? tmp : pow(tmp, 1.5F)) / pow(tmp + ring_spacing2 * delta * delta, 1.5F) * backprojection_normalisation;
135  }
136  };
137 
138  JacobianForIntBP jacobian;
139  bool use_piecewise_linear_interpolation_now;
140  bool use_exact_Jacobian_now;
141 
142  void calculate_proj_matrix_elems_for_one_bin(ProjMatrixElemsForOneBin&) const override;
143 
144  void set_defaults() override;
145  void initialise_keymap() override;
146  bool post_processing() override;
147 
148  float get_element(const Bin& bin, const CartesianCoordinate3D<float>& densel_ctr) const;
149 
150 private:
151  void find_tang_ax_pos_diff(float& tang_pos_diff,
152  float& ax_pos_diff,
153  const Bin& bin,
154  const CartesianCoordinate3D<float>& point) const;
155 };
156 
157 END_NAMESPACE_STIR
158 
159 #endif
static const char *const registered_name
Name which will be used when parsing a ProjMatrixByBin object.
Definition: ProjMatrixByBinUsingInterpolation.h:55
Import of std::shared_ptr, std::dynamic_pointer_cast and std::static_pointer_cast (or corresponding b...
Declaration of class stir::ProjDataInfoCylindrical.
declaration of stir::ProjMatrixByBin and its helpers classes
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
This stores the non-zero projection matrix elements for every &#39;densel&#39; that contributes to a given bi...
Definition: ProjMatrixElemsForOneBin.h:68
projection data info for data corresponding to a &#39;cylindrical&#39; sampling.
Definition: ProjDataInfoCylindrical.h:48
Computes projection matrix elements for VoxelsOnCartesianGrid images by using an interpolation model...
Definition: ProjMatrixByBinUsingInterpolation.h:50
defines the stir::CartesianCoordinate3D<coordT> class
Declaration of class stir::RegisteredParsingObject.