STIR 6.4.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*/
21
22#ifndef __stir_data_SinglesRates_H__
23#define __stir_data_SinglesRates_H__
24
25//#include "stir/Array.h"
28#include "stir/Scanner.h"
29#include "stir/shared_ptr.h"
30#include "stir/deprecated.h"
31#include <vector>
32
33START_NAMESPACE_STIR
34
35class TimeFrameDefinitions;
36
46{
47
48public:
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
91private:
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
112class SinglesRates : public RegisteredObject<SinglesRates>
113{
114public:
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
148
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
162 get_time_frame_definitions() const = 0;
163#endif
164
165protected:
166 shared_ptr<Scanner> scanner_sptr;
167};
168
169END_NAMESPACE_STIR
170
172#endif
Declaration of class stir::DetectionPosition.
Declaration of class stiir::RegisteredObject.
Declaration of class stir::Scanner.
Implementation of class stir::SinglesRates.
A class for storing coordinates of a detection.
Definition DetectionPosition.h:61
FrameSinglesRates(std::vector< float > &avg_singles_rates, double start_time, double end_time, shared_ptr< Scanner > scanner)
Constructor taking all arguments.
Definition SinglesRates.cxx:30
float get_singles_rate(int singles_bin_index) const
Get singles rate for a particular singles bin index.
Definition SinglesRates.cxx:43
FrameSinglesRates(double start_time, double end_time, shared_ptr< Scanner > scanner)
Constructor without singles rates.
A class for storing some info on the scanner.
Definition Scanner.h:108
The base-class for using singles info.
Definition SinglesRates.h:113
virtual float get_singles(const int singles_bin_index, const double start_time, const double end_time) const =0
Get the number of singles for a particular singles unit and a frame with the specified start and end ...
virtual float get_singles_rate(const int singles_bin_index, const double start_time, const double end_time) const
Get the (average) singles rate for a particular singles unit and a frame with the specified start and...
Definition SinglesRates.cxx:69
shared_ptr< Scanner > scanner_sptr
Generate a FramesSinglesRate - containing the average rates.
Definition SinglesRates.h:166
const Scanner * get_scanner_ptr() const
Get the scanner pointer.
Definition SinglesRates.inl:23
Class used for storing time frame durations.
Definition TimeFrameDefinitions.h:39
iterator begin()
use to initialise an iterator to the first element of the vector
Definition VectorWithOffset.inl:190
This file declares a deprecation macro.
Import of std::shared_ptr, std::dynamic_pointer_cast and std::static_pointer_cast into the stir names...