STIR  6.2.0
SinglesRates.h
Go to the documentation of this file.
1 
2 //
3 //
4 /*
5  Copyright (C) 2000- 2007, Hammersmith Imanet Ltd
6  Copyright (C) 2021, University College London
7  This file is part of STIR.
8 
9  SPDX-License-Identifier: Apache-2.0
10 
11  See STIR/LICENSE.txt for details
12 */
22 #ifndef __stir_data_SinglesRates_H__
23 #define __stir_data_SinglesRates_H__
24 
25 //#include "stir/Array.h"
26 #include "stir/DetectionPosition.h"
27 #include "stir/RegisteredObject.h"
28 #include "stir/Scanner.h"
29 #include "stir/shared_ptr.h"
30 #include "stir/deprecated.h"
31 #include <vector>
32 
33 START_NAMESPACE_STIR
34 
35 class TimeFrameDefinitions;
36 
46 {
47 
48 public:
49  typedef std::vector<float>::iterator iterator;
50  typedef std::vector<float>::const_iterator const_iterator;
51 
53 
55  FrameSinglesRates(std::vector<float>& avg_singles_rates, double start_time, double end_time, shared_ptr<Scanner> scanner);
57 
60  FrameSinglesRates(double start_time, double end_time, shared_ptr<Scanner> scanner);
61 
63  //
64  // The singles rate returned is the rate for a whole singles unit.
65  //
66  float get_singles_rate(int singles_bin_index) const;
67 
69  //
70  // The singles rate returned is the rate for a whole singles unit.
71  //
72  float get_singles_rate(const DetectionPosition<>& det_pos) const;
73 
74  const_iterator begin() const { return this->_singles.begin(); }
75 
76  iterator begin() { return this->_singles.begin(); }
77 
78  const_iterator end() const { return this->_singles.end(); }
79 
80  iterator end() { return this->_singles.end(); }
81 
83  double get_start_time() const;
84 
86  double get_end_time() const;
87 
89  inline const Scanner* get_scanner_ptr() const;
90 
91 private:
92  double _start_time;
93  double _end_time;
94  std::vector<float> _singles;
95 
96  // Scanner specifics
97  shared_ptr<Scanner> _scanner_sptr;
98 };
99 
112 class SinglesRates : public RegisteredObject<SinglesRates>
113 {
114 public:
115  ~SinglesRates() override {}
117 
123  virtual float get_singles_rate(const int singles_bin_index, const double start_time, const double end_time) const;
124 
126 
130  virtual float get_singles(const int singles_bin_index, const double start_time, const double end_time) const = 0;
131 
133 
139  virtual float get_singles_rate(const DetectionPosition<>& det_pos, const double start_time, const double end_time) const;
140 
142 
149  virtual float get_singles(const DetectionPosition<>& det_pos, const double start_time, const double end_time) const;
150 
152  inline const Scanner* get_scanner_ptr() const;
153 
155  // for a frame begining at start_time and ending at end_time.
156  // virtual FrameSinglesRates get_rates_for_frame(double start_time,
157  // double end_time) const = 0;
158 
159 #if 0
160  virtual TimeFrameDefinitions
162  get_time_frame_definitions() const = 0;
163 #endif
164 
165 protected:
166  shared_ptr<Scanner> scanner_sptr;
167 };
168 
169 END_NAMESPACE_STIR
170 
172 #endif
Class used for storing time frame durations.
Definition: TimeFrameDefinitions.h:38
shared_ptr< Scanner > scanner_sptr
Generate a FramesSinglesRate - containing the average rates.
Definition: SinglesRates.h:166
This file declares a deprecation macro.
A single frame of singles information.
Definition: SinglesRates.h:45
Import of std::shared_ptr, std::dynamic_pointer_cast and std::static_pointer_cast (or corresponding b...
Implementation of class stir::SinglesRates.
A class for storing some info on the scanner.
Definition: Scanner.h:107
Declaration of class stir::Scanner.
Declaration of class stir::DetectionPosition.
Declaration of class stiir::RegisteredObject.
Helper class to provide registry mechanisms to a Base classSuppose you have a hierarchy of classes wi...
Definition: RegisteredObject.h:95
The base-class for using singles info.
Definition: SinglesRates.h:112