STIR  6.2.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 */
23 #ifndef __stir_data_SinglesRatesForTimeSlices_H__
24 #define __stir_data_SinglesRatesForTimeSlices_H__
25 
26 #include "stir/data/SinglesRates.h"
27 #include "stir/Array.h"
29 
30 START_NAMESPACE_STIR
31 
38 
39 {
40 public:
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
96  //
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
102  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 
122  TimeFrameDefinitions get_time_frame_definitions() const;
123 
124 protected:
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 
149 END_NAMESPACE_STIR
150 
151 #endif
#define STIR_DEPRECATED
Deprecation macro.
Definition: deprecated.h:19
Class used for storing time frame durations.
Definition: TimeFrameDefinitions.h:38
Declaration of class stir::SinglesRates.
Declaration of class stir::TimeFrameDefinitions.
Array< 2, int > _singles
total singles per time slice and singles-bin
Definition: SinglesRatesForTimeSlices.h:127
std::vector< double > _times
end times of each time slice (in secs)
Definition: SinglesRatesForTimeSlices.h:131
A single frame of singles information.
Definition: SinglesRates.h:45
defines the Array class for multi-dimensional (numeric) arrays
double _singles_time_interval
time interval in secs
Definition: SinglesRatesForTimeSlices.h:140
A class for singles that are recorded at equal time intervals.
Definition: SinglesRatesForTimeSlices.h:37
The base-class for using singles info.
Definition: SinglesRates.h:112