STIR 6.5.0
CListRecordPETSIRD.h
Go to the documentation of this file.
1/*
2 Copyright 2025, 2026 University Medical Center Groningen
3 Copyright 2025 National Physical Laboratory
4
5 SPDX-License-Identifier: Apache-2.0
6 See STIR/LICENSE.txt for details.
7*/
8
18
19#ifndef __stir_listmode_CListRecordPETSIRD_H__
20#define __stir_listmode_CListRecordPETSIRD_H__
21
25#include "stir/PETSIRDInfo.h"
26#include "stir/Succeeded.h"
27
28START_NAMESPACE_STIR
29
30template <class ProjDataInfoT>
31class CListEventPETSIRD : public CListEventScannerWithDiscreteDetectors<ProjDataInfoT>
32{
33public:
35 inline CListEventPETSIRD(shared_ptr<const ProjDataInfo> proj_data_info_sptr)
36 : CListEventScannerWithDiscreteDetectors<ProjDataInfoT>(proj_data_info_sptr)
37 {}
38
39 inline CListEventPETSIRD(shared_ptr<const ProjDataInfo> proj_data_info_sptr,
40 const DetectionPositionPair<>& det_pos_pair,
41 bool is_prompt_v)
42 : CListEventScannerWithDiscreteDetectors<ProjDataInfoT>(proj_data_info_sptr),
43 _det_pos_pair(det_pos_pair),
44 _is_prompt(is_prompt_v)
45 {}
46
47 inline bool is_prompt() const override { return this->_is_prompt; }
48
49 bool operator==(const CListEventPETSIRD& other) const
50 {
51 if (this == &other)
52 return true;
53
54 return is_prompt() == other.is_prompt() && get_detection_position() == other.get_detection_position();
55 }
56
57 inline Succeeded set_prompt(const bool prompt) override
58 {
59 this->_is_prompt = prompt;
60 return Succeeded::yes;
61 }
62
63 virtual void get_detection_position(DetectionPositionPair<>& det_pos_pair_arg) const override
64 {
65 det_pos_pair_arg = this->_det_pos_pair;
66 }
67
68 virtual void set_detection_position(const DetectionPositionPair<>& det_pos_pair_arg) override
69 {
70 this->_det_pos_pair = det_pos_pair_arg;
71 }
72
73private:
74 DetectionPositionPair<> _det_pos_pair;
75 bool _is_prompt;
76};
77
78class CListTimePETSIRD : public ListTime
79{
80public:
81 inline unsigned long get_time_in_millisecs() const { return static_cast<unsigned long>(time); }
82 inline Succeeded set_time_in_millisecs(const unsigned long time_in_millisecs)
83 {
84 time = time_in_millisecs;
85 return Succeeded::yes;
86 }
87 bool operator==(const CListTimePETSIRD& other) const { return time == other.time; }
88 inline bool is_time() const { return true; }
89 uint32_t time;
90};
91
106class CListRecordPETSIRD : public CListRecord
107{
108public:
109 CListRecordPETSIRD(shared_ptr<const PETSIRDInfo> petsird_info_sptr, shared_ptr<const ProjDataInfo> proj_data_info_sptr)
110 : event_data(make_event_data(proj_data_info_sptr)),
111 petsird_info_sptr(std::move(petsird_info_sptr)),
112 proj_data_info_sptr(std::move(proj_data_info_sptr))
113 {}
114
116 bool is_time() const override { return true; }
118 bool is_event() const override { return true; }
119
120 CListEvent& event() override { return *event_data; }
121 const CListEvent& event() const override { return *event_data; }
122
123 CListTimePETSIRD& time() override { return time_data; }
124 const CListTimePETSIRD& time() const override { return time_data; }
125
126 bool operator==(const CListRecordPETSIRD& e2) const { return event_data == e2.event_data && time_data == e2.time_data; }
127
128 Succeeded init_from_data(const petsird::CoincidenceEvent& event, const bool is_prompt);
129
130private:
131 static std::unique_ptr<CListEventScannerWithDiscreteDetectorsBase>
132 make_event_data(shared_ptr<const ProjDataInfo> proj_data_info);
133
134 std::unique_ptr<CListEventScannerWithDiscreteDetectorsBase> event_data;
135 CListTimePETSIRD time_data;
136
137 shared_ptr<const PETSIRDInfo> petsird_info_sptr;
138 shared_ptr<const ProjDataInfo> proj_data_info_sptr;
139
140 bool is_prompt_event = true;
141};
142
143END_NAMESPACE_STIR
144
145#endif
Declarations of class stir::CListEventScannerWithDiscreteDetectors.
Declarations of classes stir::CListRecord, and stir::CListEvent which are used for list mode data.
Declaration of class stir::DetectionPositionPair.
Declaration of class stir::PETSIRDInfo.
Declaration of class stir::Succeeded.
Class for storing and using a coincidence event from a list mode file.
Definition CListRecord.h:54
bool is_time() const override
This record also has valid timing information.
Definition CListRecordPETSIRD.h:116
bool is_event() const override
This record represents a coincidence event.
Definition CListRecordPETSIRD.h:118
Class for records in a PET list mode file.
Definition CListRecord.h:68