STIR 6.5.0
PETSIRDInfo.h
Go to the documentation of this file.
1/*
2 Copyright 2025, University Medical Center Groningen
3
4 SPDX-License-Identifier: Apache-2.0
5 See STIR/LICENSE.txt for detail
6*/
7#ifndef __stir_listmode_PETSIRDInfo_H__
8#define __stir_listmode_PETSIRDInfo_H__
16
19#include "petsird/protocols.h"
20#include "stir/Scanner.h"
22#include <set>
23#include <map>
24
25#include "petsird_helpers.h"
26#include "petsird_helpers/create.h" // for make_detection_bin
27#include "petsird_helpers/geometry.h" // depending on where get_detection_efficiency lives
28
29START_NAMESPACE_STIR
30
38{
39
40 bool operator()(const petsird::ExpandedDetectionBin& a, const petsird::ExpandedDetectionBin& b) const
41 {
42 // Adjust field names if needed (I assume: module, element, energy_bin)
43 if (a.module_index < b.module_index)
44 return true;
45 if (a.module_index > b.module_index)
46 return false;
47
48 if (a.element_index < b.element_index)
49 return true;
50 if (a.element_index > b.element_index)
51 return false;
52 return a.energy_index < b.energy_index;
53 }
54};
55
60 = std::map<petsird::ExpandedDetectionBin, stir::DetectionPosition<>, ExpandedDetectionBinLess>;
61
62using STIRToPETSIRDDetectorIndexMap = std::map<stir::DetectionPosition<>, petsird::ExpandedDetectionBin>;
63
66*/
67class PETSIRDInfo
68{
69public:
70 explicit PETSIRDInfo(shared_ptr<const petsird::Header> header_sptr, std::string scanner_geometry = "");
71
72 // void initialize();
73
74 inline std::shared_ptr<Scanner> get_scanner_sptr() const { return stir_scanner_sptr; }
75
76 inline const petsird::ScannerInformation& get_petsird_scanner_info() const { return petsird_header_sptr->scanner; }
77
78 inline shared_ptr<PETSIRDToSTIRDetectorIndexMap> get_petsird_to_stir_map() const { return petsird_to_stir; }
79
80 inline shared_ptr<STIRToPETSIRDDetectorIndexMap> get_stir_to_petsird_map() const { return stir_to_petsird; }
81
82 inline shared_ptr<DetectorCoordinateMap::det_pos_to_coord_type> get_petsird_map_sptr() const { return petsird_map_sptr; }
83
84 inline bool is_generic_geometry_used() const { return is_generic_geometry; }
85
86 inline bool is_block_configuration_used() const { return is_block_configuration; }
87
88 inline bool is_cylindrical_configuration_used() const { return is_cylindrical; };
89
90 float get_detection_efficiency_for_bin(const stir::DetectionPositionPair<>& dp) const;
91
92 float get_lower_energy_threshold() const;
93
94 float get_upper_energy_threshold() const;
95
96private:
105 int figure_out_scanner_blocks_and_rotation_axis(std::set<float>& unique_dim1_values,
106 std::set<float>& unique_dim2_values,
107 std::set<float>& unique_dim3_values);
113 void figure_out_block_angles(std::set<float>& unique_angle_modules, const int rot_axis);
124 void figure_out_block_element_transformations(std::set<float>& unique_dim1_values,
125 std::set<float>& unique_dim2_values,
126 std::set<float>& unique_dim3_values,
127 float& radius,
128 int& radius_index,
129 const int rotation_axis);
130
132
136 shared_ptr<const petsird::Header> petsird_header_sptr;
138 shared_ptr<Scanner> stir_scanner_sptr;
140 uint32_t numberOfModules;
142 uint32_t numberOfElementsIndices;
144 uint32_t blocks_per_bucket_transaxial;
146 uint32_t blocks_per_bucket_axial;
148 uint32_t num_axial_crystals_per_block;
150 uint32_t num_trans_crystals_per_block;
152 bool is_cylindrical = true;
153
154 bool is_generic_geometry = false;
155
156 bool is_block_configuration = false;
157
158 petsird::TypeOfModule type_of_module;
159
160 petsird::TypeOfModulePair module_pair;
161
162 std::string forced_geometry = "";
164 shared_ptr<PETSIRDToSTIRDetectorIndexMap> petsird_to_stir;
165
166 shared_ptr<STIRToPETSIRDDetectorIndexMap> stir_to_petsird;
168 shared_ptr<DetectorCoordinateMap::det_pos_to_coord_type> petsird_map_sptr;
169};
170
171END_NAMESPACE_STIR
172
173#endif
Declaration of class stir::DetectionPositionPair.
Declaration of class stir::DetectionPosition.
Declaration of class stir::DetectorCoordinateMap.
Declaration of class stir::Scanner.
A class for storing 2 coordinates-sets of a detection, together with a timing-position index (for TOF...
Definition DetectionPositionPair.h:41
PETSIRDInfo(shared_ptr< const petsird::Header > header_sptr, std::string scanner_geometry="")
Definition PETSIRDInfo.cxx:192
std::map< petsird::ExpandedDetectionBin, stir::DetectionPosition<>, ExpandedDetectionBinLess > PETSIRDToSTIRDetectorIndexMap
Mapping type from petsird::ExpandedDetectionBin to stir::DetectionPosition.
Definition PETSIRDInfo.h:59
Comparator for ordering petsird::ExpandedDetectionBin in std::map.
Definition PETSIRDInfo.h:38