STIR 6.4.0
SinglesRatesForTimeSlices.h
Go to the documentation of this file.
1//
2/*
3 Copyright (C) 2000- 2007, Hammersmith Imanet Ltd
4 Copyright (C) 2021, University College London
5 This file is part of STIR.
6
7 SPDX-License-Identifier: Apache-2.0
8
9 See STIR/LICENSE.txt for details
10*/
22
23#ifndef __stir_data_SinglesRatesForTimeSlices_H__
24#define __stir_data_SinglesRatesForTimeSlices_H__
25
27#include "stir/Array.h"
29
30START_NAMESPACE_STIR
31
38
39{
40public:
43
44 // implementation of pure virtual in SinglesRates
45 float get_singles(const int singles_bin_index, const double start_time, const double end_time) const override;
46
48 // for a frame begining at start_time and ending at end_time.
49 FrameSinglesRates STIR_DEPRECATED get_rates_for_frame(double start_time, double end_time) const;
50
51 /*
52 *! Get time slice index for a time slice ending at or after t.
53 *
54 * Each slice of singles data has a corresponing time recorded with
55 * the singles counts. This time is considered to represent the time
56 * at the end of the slice.
57 *
58 * For a given double precision number of seconds, t, this function
59 * will return the slice index for the first time slice that has a
60 * corresponding time greater than or equal to t.
61 *
62 * Assuming contiguous slices that end at the time recorded for the slice,
63 * this function returns the slice in which t is contained.
64 *
65 * This function assumes that all slices are continguous.
66 * If the supplied t does not actually fall within a frame, the closest
67 * frame (ending after t) is returned. Values of t before the first time
68 * slice will result in the index to the first slice being returned.
69 */
70 virtual int get_end_time_slice_index(double t) const;
71
72 /*
73 *! Get time slice index for a time slice ending after t.
74 *
75 * Each slice of singles data has a corresponing time recorded with
76 * the singles counts. This time is considered to represent the time
77 * at the end of the slice.
78 *
79 * For a given double precision number of seconds, t, this function
80 * will return the slice index for the first time slice that has a
81 * correspdoning time greater than t.
82 *
83 * Assuming contiguous slices that end at the time recorded for the slice,
84 * this function returns the slice which starts before t. A time interval
85 * that begins at t should contain only time slices that end _after_ t
86 * not at t.
87 *
88 * This function assumes that all slices are continguous.
89 * If the supplied t does not actually fall within a frame, the closest
90 * frame (ending after t) is returned. Values of t before the first time
91 * slice will result in the index to the first slice being returned.
92 */
93 virtual int get_start_time_slice_index(double t) const;
94
95#if 0
97 //
98 // The singles rate returned is the rate for a whole singles unit.
99 //
100 int get_singles_rate(int singles_bin_index, int time_slice) const;
101#endif
103 void set_singles(int singles_bin_index, int time_slice, int new_singles);
104
106 //
107 // Returns the number of new bins.
108 int rebin(std::vector<double>& new_end_times);
109
111 std::vector<double> get_times() const;
112
113 // Some inspectors
114
116 int get_num_time_slices() const;
117
119 double get_singles_time_interval() const;
120
123
124protected:
126
128
130
131 std::vector<double> _times;
132
133 int _num_time_slices;
134
136
141
143 void set_time_interval();
144
146 double get_slice_start_time(int slice_index) const;
147};
148
149END_NAMESPACE_STIR
150
151#endif
defines the stir::Array class for multi-dimensional (numeric) arrays
Declaration of class stir::SinglesRates.
Declaration of class stir::TimeFrameDefinitions.
This class defines multi-dimensional (numeric) arrays.
Definition Array.h:78
A single frame of singles information.
Definition SinglesRates.h:46
int get_num_time_slices() const
Return the number of time slices.
Definition SinglesRatesForTimeSlices.cxx:250
double _singles_time_interval
time interval in secs
Definition SinglesRatesForTimeSlices.h:140
int rebin(std::vector< double > &new_end_times)
Rebin the sgl slices into a different set of consecutive slices.
Definition SinglesRatesForTimeSlices.cxx:192
std::vector< double > get_times() const
Get the vector of time values for each time slice index.
Definition SinglesRatesForTimeSlices.cxx:244
FrameSinglesRates STIR_DEPRECATED get_rates_for_frame(double start_time, double end_time) const
Generate a FramesSinglesRate - containing the average rates.
Definition SinglesRatesForTimeSlices.cxx:42
float get_singles(const int singles_bin_index, const double start_time, const double end_time) const override
Get the number of singles for a particular singles unit and a frame with the specified start and end ...
Definition SinglesRatesForTimeSlices.cxx:262
double get_singles_time_interval() const
Return the time interval per slice of singles data.
Definition SinglesRatesForTimeSlices.cxx:256
void set_time_interval()
Calculate and set _singles_time_interval from _times.
Definition SinglesRatesForTimeSlices.cxx:330
void set_singles(int singles_bin_index, int time_slice, int new_singles)
Set a singles by singles bin index and time slice.
Definition SinglesRatesForTimeSlices.cxx:180
TimeFrameDefinitions get_time_frame_definitions() const
return time-intervals for every slice
Definition SinglesRatesForTimeSlices.cxx:387
Array< 2, int > _singles
total singles per time slice and singles-bin
Definition SinglesRatesForTimeSlices.h:127
double get_slice_start_time(int slice_index) const
get slice start time.
Definition SinglesRatesForTimeSlices.cxx:368
std::vector< double > _times
end times of each time slice (in secs)
Definition SinglesRatesForTimeSlices.h:131
SinglesRatesForTimeSlices()
Default constructor.
Definition SinglesRatesForTimeSlices.cxx:36
The base-class for using singles info.
Definition SinglesRates.h:113
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
Class used for storing time frame durations.
Definition TimeFrameDefinitions.h:39
#define STIR_DEPRECATED
Deprecation macro.
Definition deprecated.h:21