STIR  6.2.0
ProjDataInfo.h
Go to the documentation of this file.
1 //
2 //
3 /*
4  Copyright (C) 2000 PARAPET partners
5  Copyright (C) 2000 - 2011-10-14, Hammersmith Imanet Ltd
6  Copyright (C) 2011-07-01 - 2011, Kris Thielemans
7  Copyright (C) 2016-17, University of Hull
8  Copyright (C) 2017-2018, 2020, 2022, 2023 University College London
9  This file is part of STIR.
10 
11  SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license
12  See STIR/LICENSE.txt for details
13 */
27 #ifndef __stir_ProjDataInfo_H__
28 #define __stir_ProjDataInfo_H__
29 
30 #include "stir/SegmentIndices.h"
31 #include "stir/ViewgramIndices.h"
32 #include "stir/SinogramIndices.h"
33 #include "stir/VectorWithOffset.h"
34 #include "stir/Scanner.h"
35 #include "stir/shared_ptr.h"
36 #include "stir/unique_ptr.h"
37 #include <string>
38 #include <memory>
39 
40 START_NAMESPACE_STIR
41 
42 template <typename elemT>
43 class Sinogram;
44 template <typename elemT>
45 class Viewgram;
46 template <typename elemT>
47 class SegmentByView;
48 template <typename elemT>
49 class SegmentBySinogram;
50 template <typename elemT>
51 class RelatedViewgrams;
52 class DataSymmetriesForViewSegmentNumbers;
53 class ViewSegmentNumbers;
54 class Bin;
55 template <typename T>
56 class LOR;
57 template <typename T>
58 class LORInAxialAndNoArcCorrSinogramCoordinates;
59 class PMessage;
60 
70 {
71 protected:
72  typedef ProjDataInfo root_type;
73 
74 public:
75  /********** static members **************/
76 
78  static ProjDataInfo* ask_parameters();
79 
81 
86  static ProjDataInfo* ProjDataInfoGE(const shared_ptr<Scanner>& scanner_ptr,
87  const int max_delta,
88  const int num_views,
89  const int num_tangential_poss,
90  const bool arc_corrected = true,
91  const int tof_mash_factor = 0);
92 
94 
96  static ProjDataInfo* ProjDataInfoCTI(const shared_ptr<Scanner>& scanner_ptr,
97  const int span,
98  const int max_delta,
99  const int num_views,
100  const int num_tangential_poss,
101  const bool arc_corrected = true,
102  const int tof_mash_factor = 0);
103 
105 
114  static unique_ptr<ProjDataInfo> construct_proj_data_info(const shared_ptr<Scanner>& scanner_sptr,
115  const int span,
116  const int max_delta,
117  const int num_views,
118  const int num_tangential_poss,
119  const bool arc_corrected = true,
120  const int tof_mash_factor = 0);
121 
122  /************ constructors ***********/
123  // TODO should probably be protected
124 
126  ProjDataInfo();
127 
129 
133  ProjDataInfo(const shared_ptr<Scanner>& scanner_ptr,
134  const VectorWithOffset<int>& num_axial_pos_per_segment,
135  const int num_views,
136  const int num_tangential_poss);
137 
139  ProjDataInfo(const shared_ptr<Scanner>& scanner_ptr,
140  const VectorWithOffset<int>& num_axial_pos_per_segment,
141  const int num_views,
142  const int num_tangential_poss,
143  const int tof_mash_factor);
144 
146  virtual ProjDataInfo* clone() const = 0;
147 
149  inline shared_ptr<ProjDataInfo> create_shared_clone() const;
150 
152  inline shared_ptr<ProjDataInfo> create_non_tof_clone() const;
153 
155  virtual ~ProjDataInfo() {}
156 
157  /**************** member functions *********/
158 
159  // ProjDataInfo& operator=(const ProjDataInfo&);
160 
162 
163 
165 
170  virtual void reduce_segment_range(const int min_segment_num, const int max_segment_num);
172 
174  virtual void set_num_views(const int num_views);
176 
178  virtual void set_num_tangential_poss(const int num_tang_poss);
180 
187  virtual void set_num_axial_poss_per_segment(const VectorWithOffset<int>& num_axial_poss_per_segment);
188 
190 
191  virtual void set_min_axial_pos_num(const int min_ax_pos_num, const int segment_num);
193 
194  virtual void set_max_axial_pos_num(const int max_ax_pos_num, const int segment_num);
195 
197 
198  virtual void set_min_tangential_pos_num(const int min_tang_poss);
200 
201  virtual void set_max_tangential_pos_num(const int max_tang_poss);
203 
207  virtual void set_tof_mash_factor(const int new_num);
209 
211 
212  inline int get_num_segments() const;
215  inline int get_num_axial_poss(const int segment_num) const;
217  inline int get_num_views() const;
219  inline int get_num_tangential_poss() const;
221  inline int get_tof_bin(const double delta) const;
222 #if 0
223 // KT: code disabled as buggy but currently not needed
225  inline int get_unmashed_tof_bin(const double delta) const;
226 #endif
227  inline int get_num_tof_poss() const;
230  inline int get_min_segment_num() const;
232  inline int get_max_segment_num() const;
234  inline int get_min_axial_pos_num(const int segment_num) const;
236  inline int get_max_axial_pos_num(const int segment_num) const;
238  inline int get_min_view_num() const;
240  inline int get_max_view_num() const;
242  inline int get_min_tangential_pos_num() const;
244  inline int get_max_tangential_pos_num() const;
246  /* 0 indicates non-TOF data, as well as the max number of TOF bins for the scanner
247  (as all TOF bins will then be added). */
248  inline int get_tof_mash_factor() const;
250  inline int get_min_tof_pos_num() const;
252  inline int get_max_tof_pos_num() const;
253 
255 
258  inline int get_num_sinograms() const;
260 
263  inline int get_num_non_tof_sinograms() const;
265  inline std::size_t size_all() const;
267 
269  inline bool is_tof_data() const;
270 
272 
278  virtual std::vector<int> get_original_view_nums() const;
279 
280  //| \name Functions that return geometrical info for a Bin
282 
284  virtual float get_tantheta(const Bin&) const = 0;
285 
287 
288  inline float get_costheta(const Bin&) const;
289 
291 
292  virtual float get_phi(const Bin&) const = 0;
293 
295 
297  virtual float get_t(const Bin&) const = 0;
298 
300 
312  virtual inline float get_m(const Bin&) const;
313 
315 
317  virtual float get_s(const Bin&) const = 0;
318 
321  float get_k(const Bin&) const;
322 
324  double get_tof_delta_time(const Bin&) const;
325 
327 
332  virtual void get_LOR(LORInAxialAndNoArcCorrSinogramCoordinates<float>&, const Bin&) const = 0;
334 
336 
337 
344  virtual float get_sampling_in_t(const Bin&) const;
345 
347 
353  virtual float get_sampling_in_m(const Bin&) const;
354 
356 
362  virtual float get_sampling_in_s(const Bin&) const;
363 
365  float get_sampling_in_k(const Bin&) const;
367 
369 
382  virtual Bin get_bin(const LOR<float>&, const double delta_time = 0.0) const = 0;
383 
385 
386  bool operator==(const ProjDataInfo& proj) const;
388 
389  bool operator!=(const ProjDataInfo& proj) const;
390 
392  virtual bool operator>=(const ProjDataInfo& proj) const;
393 
395 
397 
398 
400  Viewgram<float> get_empty_viewgram(const ViewgramIndices&) const;
402  Sinogram<float> get_empty_sinogram(const SinogramIndices&) const;
404  SegmentByView<float> get_empty_segment_by_view(const SegmentIndices&) const;
406  SegmentBySinogram<float> get_empty_segment_by_sinogram(const SegmentIndices&) const;
407 
409 
410  Viewgram<float> get_empty_viewgram(const int view_num,
411  const int segment_num,
412  const bool make_num_tangential_poss_odd = false,
413  const int timing_pos_num = 0) const;
414 
416 
417  Sinogram<float> get_empty_sinogram(const int ax_pos_num,
418  const int segment_num,
419  const bool make_num_tangential_poss_odd = false,
420  const int timing_pos_num = 0) const;
421 
423 
424  SegmentByView<float> get_empty_segment_by_view(const int segment_num,
425  const bool make_num_tangential_poss_odd = false,
426  const int timing_pos_num = 0) const;
428 
429  SegmentBySinogram<float> get_empty_segment_by_sinogram(const int segment_num,
430  const bool make_num_tangential_poss_odd = false,
431  const int timing_pos_num = 0) const;
432 
434 
435  // TODOTOF
436  RelatedViewgrams<float> get_empty_related_viewgrams(const ViewgramIndices&,
437  const shared_ptr<DataSymmetriesForViewSegmentNumbers>&,
438  const bool make_num_tangential_poss_odd = false,
439  const int timing_pos_num = 0) const;
441 
443  inline const Scanner* get_scanner_ptr() const;
444 
446  inline shared_ptr<Scanner> get_scanner_sptr() const;
447 
449  virtual std::string parameter_info() const;
450 
453  {
454  float low_lim;
455  float high_lim;
456  };
457 
464 #if 0
465  mutable VectorWithOffset<Float1Float2> tof_bin_unmashed_boundaries_mm;
467  mutable VectorWithOffset<Float1Float2> tof_bin_unmashed_boundaries_ps;
468 #endif
469 
471  void set_bed_position_horizontal(const float bed_position_horizontal_arg)
472  {
473  bed_position_horizontal = bed_position_horizontal_arg;
474  }
475 
478  {
479  return bed_position_horizontal;
480  }
481 
483  void set_bed_position_vertical(const float bed_position_vertical_arg)
484  {
485  bed_position_vertical = bed_position_vertical_arg;
486  }
487 
490  {
491  return bed_position_vertical;
492  }
493 
494  inline bool has_energy_information() const
495  {
496  return scanner_ptr->has_energy_information();
497  }
498 
499 protected:
500  virtual bool blindly_equals(const root_type* const) const = 0;
501 
502 private:
503  shared_ptr<Scanner> scanner_ptr;
504  int min_view_num;
505  int max_view_num;
506  int min_tangential_pos_num;
507  int max_tangential_pos_num;
509  int min_tof_pos_num;
511  int max_tof_pos_num;
512 #if 0
513  int min_unmashed_tof_pos_num;
516  int max_unmashed_tof_pos_num;
517 #endif
518  int tof_mash_factor;
521  float tof_increament_in_mm;
523  int num_tof_bins;
524  VectorWithOffset<int> min_axial_pos_per_seg;
525  VectorWithOffset<int> max_axial_pos_per_seg;
526  float bed_position_horizontal;
527  float bed_position_vertical;
528 };
529 
530 END_NAMESPACE_STIR
531 
532 #include "stir/ProjDataInfo.inl"
533 
534 #endif // __ProjDataInfo_H__
A class for 2d projection data.
Definition: FBP3DRPReconstruction.h:39
A very simple class to store segment numbers and any other indices that define a segment.
Definition: SegmentIndices.h:33
Definition of class stir::SegmentIndices.
A class for storing (3d) projection data with fixed SegmentIndices.
Definition: FBP3DRPReconstruction.h:41
Implementations of inline functions for class stir::ProjDataInfo.
VectorWithOffset< Float1Float2 > tof_bin_boundaries_ps
Vector which holds the lower and higher boundary for each TOF position in ps`, for faster access...
Definition: ProjDataInfo.h:461
virtual ~ProjDataInfo()
Destructor.
Definition: ProjDataInfo.h:155
Definition of class stir::SinogramIndices.
Import of std::shared_ptr, std::dynamic_pointer_cast and std::static_pointer_cast (or corresponding b...
A class for storing (3d) projection data with fixed SegmentIndices.
Definition: ArcCorrection.h:40
A class for storing some info on the scanner.
Definition: Scanner.h:107
Struct which holds two floating numbers.
Definition: ProjDataInfo.h:452
Declaration of class stir::Scanner.
void set_bed_position_vertical(const float bed_position_vertical_arg)
Set vertical bed position.
Definition: ProjDataInfo.h:483
VectorWithOffset< Float1Float2 > tof_bin_boundaries_mm
Vector which holds the lower and higher boundary for each TOF position in mm, for faster access...
Definition: ProjDataInfo.h:459
Definition of class stir::ViewgramIndices.
A class for storing coordinates and value of a single projection bin.
Definition: Bin.h:48
defines the stir::VectorWithOffset class
A class for LORs.
Definition: LORCoordinates.h:40
void set_bed_position_horizontal(const float bed_position_horizontal_arg)
Vector which holds the lower and higher boundary for each TOF position, without the application of TO...
Definition: ProjDataInfo.h:471
float get_bed_position_horizontal() const
Get horizontal bed position.
Definition: ProjDataInfo.h:477
A very simple class to store all dincies to get a (2D) Sinogram.
Definition: SinogramIndices.h:33
float get_bed_position_vertical() const
Get vertical bed position.
Definition: ProjDataInfo.h:489
Import of std::unique_ptr into the stir namespace, together with work-arounds for other compilers...
An (abstract base) class that contains information on the projection data.
Definition: ProjDataInfo.h:69
A very simple class to store all dincies to get a (2D) Viewgram.
Definition: ViewgramIndices.h:32