STIR  6.2.0
ProjDataInfoCylindricalNoArcCorr.h
Go to the documentation of this file.
1 //
2 //
3 /*
4  Copyright (C) 2000- 2011-06-24, Hammersmith Imanet Ltd
5  Copyright (C) 2011-07-01 - 2011, Kris Thielemans
6  Copyright (C) 2016, University of Hull
7  This file is part of STIR.
8 
9  SPDX-License-Identifier: Apache-2.0
10 
11  See STIR/LICENSE.txt for details
12 */
23 #ifndef __stir_ProjDataInfoCylindricalNoArcCorr_H__
24 #define __stir_ProjDataInfoCylindricalNoArcCorr_H__
25 
28 #include "stir/VectorWithOffset.h"
30 
31 START_NAMESPACE_STIR
32 
33 class Succeeded;
83 {
84 private:
86 #ifdef SWIG
87  // SWIG needs this typedef to be public
88  public:
89 #endif
91 
92 public:
96 
97  ProjDataInfoCylindricalNoArcCorr(const shared_ptr<Scanner> scanner_ptr,
98  const float ring_radius,
99  const float angular_increment,
100  const VectorWithOffset<int>& num_axial_pos_per_segment,
101  const VectorWithOffset<int>& min_ring_diff_v,
102  const VectorWithOffset<int>& max_ring_diff_v,
103  const int num_views,
104  const int num_tangential_poss,
105  const int tof_mash_factor = 0);
106 
108 
110  ProjDataInfoCylindricalNoArcCorr(const shared_ptr<Scanner> scanner_ptr,
111  const VectorWithOffset<int>& num_axial_pos_per_segment,
112  const VectorWithOffset<int>& min_ring_diff_v,
113  const VectorWithOffset<int>& max_ring_diff_v,
114  const int num_views,
115  const int num_tangential_poss,
116  const int tof_mash_factor = 0);
117 
118  ProjDataInfo* clone() const override;
119 
120  bool operator==(const self_type&) const;
121 
123 
127  inline float get_s(const Bin&) const override;
128 
130  inline float get_angular_increment() const;
131 
132  std::string parameter_info() const override;
133 
135 
136 
159  inline bool
160  get_view_tangential_pos_num_for_det_num_pair(int& view_num, int& tang_pos_num, const int det1_num, const int det2_num) const;
162 
175  inline void
176  get_det_num_pair_for_view_tangential_pos_num(int& det1_num, int& det2_num, const int view_num, const int tang_pos_num) const;
177 
179 
188  inline Succeeded get_bin_for_det_pos_pair(Bin&, const DetectionPositionPair<>&) const;
189 
191 
198  inline void get_det_pos_pair_for_bin(DetectionPositionPair<>&, const Bin&) const;
199 
201 
204  unsigned int get_num_det_pos_pairs_for_bin(const Bin&, bool ignore_non_spatial_dimensions = true) const;
205 
207 
218  void get_all_det_pos_pairs_for_bin(std::vector<DetectionPositionPair<>>&,
219  const Bin&,
220  bool ignore_non_spatial_dimensions = true) const;
221 
222 private:
223  // old function, now private. Use get_bin_for_det_pos_pair instead.
225 
231  inline Succeeded get_bin_for_det_pair(Bin&,
232  const int det1_num,
233  const int ring1_num,
234  const int det2_num,
235  const int ring2_num,
236  const int mashed_timing_pos_num = 0) const;
237 
238 public:
240 
247  inline void get_det_pair_for_bin(int& det_num1, int& ring_num1, int& det_num2, int& ring_num2, const Bin& bin) const;
248 
250 
251  Bin get_bin(const LOR<float>&, const double delta_time) const override;
252 
254 
255 
260  Succeeded find_scanner_coordinates_given_cartesian_coordinates(int& det1,
261  int& det2,
262  int& ring1,
263  int& ring2,
265  const CartesianCoordinate3D<float>& c2) const;
266 
267  void find_cartesian_coordinates_of_detection(CartesianCoordinate3D<float>& coord_1,
269  const Bin& bin) const;
270 
271  void find_cartesian_coordinates_given_scanner_coordinates(CartesianCoordinate3D<float>& coord_1,
273  const int Ring_A,
274  const int Ring_B,
275  const int det1,
276  const int det2,
277  const int timing_pos_num) const;
278 
279  void find_bin_given_cartesian_coordinates_of_detection(Bin& bin,
280  const CartesianCoordinate3D<float>& coord_1,
281  const CartesianCoordinate3D<float>& coord_2) const;
283 
284 private:
285  float ring_radius;
286  float angular_increment;
287 
289  float get_psi_offset() const;
290 
291  // used in get_view_tangential_pos_num_for_det_num_pair()
292  struct Det1Det2
293  {
294  int det1_num;
295  int det2_num;
296  };
297  mutable VectorWithOffset<VectorWithOffset<Det1Det2>> uncompressed_view_tangpos_to_det1det2;
298  mutable bool uncompressed_view_tangpos_to_det1det2_initialised;
300  void initialise_uncompressed_view_tangpos_to_det1det2() const;
301 
302  // used in get_view_tangential_pos_num_for_det_num_pair()
303  // we prestore a lookup-table in terms for unmashed view/tangpos
304  struct ViewTangPosSwap
305  {
306  int view_num;
307  int tang_pos_num;
308  bool swap_detectors;
309  };
310  mutable VectorWithOffset<VectorWithOffset<ViewTangPosSwap>> det1det2_to_uncompressed_view_tangpos;
311  mutable bool det1det2_to_uncompressed_view_tangpos_initialised;
313  void initialise_det1det2_to_uncompressed_view_tangpos() const;
314 
316  inline void initialise_uncompressed_view_tangpos_to_det1det2_if_not_done_yet() const;
318  inline void initialise_det1det2_to_uncompressed_view_tangpos_if_not_done_yet() const;
319 
320  bool blindly_equals(const root_type* const) const override;
321 };
322 
323 END_NAMESPACE_STIR
324 
326 
327 #endif
Declaration of class stir::ProjDataInfoCylindrical.
Implementation of inline functions of class ProjDataInfoCylindricalNoArcCorr.
A class for storing coordinates and value of a single projection bin.
Definition: Bin.h:48
defines the stir::VectorWithOffset class
projection data info for data corresponding to a &#39;cylindrical&#39; sampling.
Definition: ProjDataInfoCylindrical.h:48
An (abstract base) class that contains information on the projection data.
Definition: ProjDataInfo.h:69
a class containing an enumeration type that can be used by functions to signal successful operation o...
Definition: Succeeded.h:43
defines the stir::CartesianCoordinate3D<coordT> class
Projection data info for data which are not arc-corrected.
Definition: ProjDataInfoCylindricalNoArcCorr.h:82
A class for storing 2 coordinates-sets of a detection, together with a timing-position index (for TOF...
Definition: DetectionPositionPair.h:40
Declaration of class stir::DetectionPositionPair.