Skip to content

Commit 4e0c3de

Browse files
committed
pre-commit
1 parent 61222b1 commit 4e0c3de

File tree

6 files changed

+55
-53
lines changed

6 files changed

+55
-53
lines changed

src/buildblock/PETSIRDInfo.cxx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ PETSIRDInfo::PETSIRDInfo(const petsird::Header& header, std::string scanner_geom
400400
polygon_area,
401401
std::abs(expected_circle_area - polygon_area) / expected_circle_area));
402402
// This is the NeuroLF ratio.
403-
forced_geometry = "BlocksOnCylindrical";
403+
forced_geometry = "BlocksOnCylindrical";
404404
if (std::abs(expected_circle_area - polygon_area) / expected_circle_area < 0.02f || forced_geometry == "cylindrical")
405405
{
406406
info(fmt::format("PETSIRDInfo: The cylindrical area {} is more than 95% matching the polygon area {}. We will presume a "
@@ -597,8 +597,9 @@ PETSIRDInfo::PETSIRDInfo(const petsird::Header& header, std::string scanner_geom
597597

598598
if (petsird_to_stir->size() != stir_to_petsird->size())
599599
{
600-
info(fmt::format("PETSIRDInfo: Map size mismatch! Forward size: {0}\n Reverse size: {1}",
601-
petsird_to_stir->size(), stir_to_petsird->size()));
600+
info(fmt::format("PETSIRDInfo: Map size mismatch! Forward size: {0}\n Reverse size: {1}",
601+
petsird_to_stir->size(),
602+
stir_to_petsird->size()));
602603

603604
error("Forward and reverse maps differ in size");
604605
}

src/include/stir/PETSIRDInfo.h

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -115,36 +115,42 @@ class PETSIRDInfo
115115
const auto& detection_bin_efficiencies = petsird_scanner_info_sptr->detection_efficiencies.detection_bin_efficiencies;
116116

117117
if (!detection_bin_efficiencies)
118-
{
119-
return 1.f; // no efficiencies available
120-
}
118+
{
119+
return 1.f; // no efficiencies available
120+
}
121121

122-
DetectionPosition<> temp_dp1;
123-
DetectionPosition<> temp_dp2;
122+
DetectionPosition<> temp_dp1;
123+
DetectionPosition<> temp_dp2;
124124

125-
if (dp.timing_pos() < 0)
125+
if (dp.timing_pos() < 0)
126126
{
127127
temp_dp1 = dp.pos2();
128128
temp_dp2 = dp.pos1();
129129
}
130-
else
130+
else
131131
{
132132
temp_dp1 = dp.pos1();
133133
temp_dp2 = dp.pos2();
134134
}
135-
135+
136136
auto it0 = stir_to_petsird->find(temp_dp1);
137137
if (it0 == stir_to_petsird->end())
138138
{
139-
info(format("DetectionPosition pos1(): tangential {}, axial {},radial {}", dp.pos1().tangential_coord(), dp.pos1().axial_coord(), dp.pos1().radial_coord()));
139+
info(format("DetectionPosition pos1(): tangential {}, axial {},radial {}",
140+
dp.pos1().tangential_coord(),
141+
dp.pos1().axial_coord(),
142+
dp.pos1().radial_coord()));
140143
error("BinNormalisationFromPETSIRD: DetectionPosition not found in STIR→PETSIRD map");
141144
}
142-
143-
auto it1 = stir_to_petsird->find(temp_dp2);
145+
146+
auto it1 = stir_to_petsird->find(temp_dp2);
144147

145148
if (it1 == stir_to_petsird->end())
146149
{
147-
info(format("DetectionPosition pos2(): tangential {}, axial {}, radial {}", dp.pos2().tangential_coord(), dp.pos2().axial_coord(), dp.pos2().radial_coord()));
150+
info(format("DetectionPosition pos2(): tangential {}, axial {}, radial {}",
151+
dp.pos2().tangential_coord(),
152+
dp.pos2().axial_coord(),
153+
dp.pos2().radial_coord()));
148154
error("BinNormalisationFromPETSIRD: DetectionPosition not found in STIR→PETSIRD map");
149155
}
150156

@@ -154,7 +160,6 @@ class PETSIRDInfo
154160
const auto det1 = petsird_helpers::make_detection_bin(*petsird_scanner_info_sptr, type_of_module, it1->second);
155161

156162
return petsird_helpers::get_detection_efficiency(*petsird_scanner_info_sptr.get(), module_pair, det0, det1);
157-
158163
}
159164

160165
float get_lower_energy_threshold() const
@@ -245,7 +250,7 @@ class PETSIRDInfo
245250

246251
petsird::TypeOfModule type_of_module;
247252

248-
petsird::TypeOfModulePair module_pair;
253+
petsird::TypeOfModulePair module_pair;
249254

250255
std::string forced_geometry = "";
251256
//! Mapping from PETSIRD expanded bins to STIR detection positions.

src/include/stir/listmode/CListModeDataPETSIRD.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class CListModeDataPETSIRD : public CListModeDataBasedOnCoordinateMap
127127
Succeeded reopen_and_prime()
128128
{
129129
// ensure PETSIRD state machine is satisfied
130-
std::cout << "1 nikos" << std::endl;
130+
std::cout << "1 nikos" << std::endl;
131131
if (current_lm_data_ptr)
132132
{
133133
try
@@ -138,14 +138,14 @@ class CListModeDataPETSIRD : public CListModeDataBasedOnCoordinateMap
138138
{}
139139
}
140140
// current_lm_data_ptr.reset();
141-
std::cout << "2 nikos" << std::endl;
141+
std::cout << "2 nikos" << std::endl;
142142
if (use_hdf5)
143143
current_lm_data_ptr.reset(new petsird::hdf5::PETSIRDReader(this->listmode_filename));
144144
else
145145
current_lm_data_ptr.reset(new petsird::binary::PETSIRDReader(this->listmode_filename));
146146

147-
petsird::Header header;
148-
current_lm_data_ptr->ReadHeader(header);
147+
petsird::Header header;
148+
current_lm_data_ptr->ReadHeader(header);
149149
// m_eof_reached = false;
150150
curr_event_in_event_block = 0;
151151
curr_is_prompt = true;
@@ -154,18 +154,18 @@ class CListModeDataPETSIRD : public CListModeDataBasedOnCoordinateMap
154154
// read until first EventTimeBlock
155155
while (true)
156156
{
157-
std::cout << "4 nikos" << std::endl;
157+
std::cout << "4 nikos" << std::endl;
158158
if (!current_lm_data_ptr->ReadTimeBlocks(this->curr_time_block))
159159
{
160-
std::cout << "5 nikos" << std::endl;
160+
std::cout << "5 nikos" << std::endl;
161161
// m_eof_reached = true;
162162
current_lm_data_ptr->Close();
163163
return Succeeded::no;
164164
}
165-
std::cout << "55 nikos" << std::endl;
165+
std::cout << "55 nikos" << std::endl;
166166
if (std::holds_alternative<petsird::EventTimeBlock>(this->curr_time_block))
167167
{
168-
std::cout << "6 nikos" << std::endl;
168+
std::cout << "6 nikos" << std::endl;
169169
this->curr_event_block = std::get<petsird::EventTimeBlock>(this->curr_time_block);
170170
return Succeeded::yes;
171171
}
@@ -200,29 +200,29 @@ class CListModeDataPETSIRD : public CListModeDataBasedOnCoordinateMap
200200
{
201201
if (pos >= m_saved_positions.size())
202202
return Succeeded::no;
203-
std::cout << "---1 nikos" << std::endl;
203+
std::cout << "---1 nikos" << std::endl;
204204
const auto& c = m_saved_positions[pos];
205205

206206
// If you cached the actual blocks, you STILL must ensure the reader state
207207
// will not be used incorrectly. Easiest: reopen+seek anyway (robust),
208208
// then overwrite curr_* with cached data.
209209
if (reopen_and_prime() == Succeeded::no)
210210
return Succeeded::no;
211-
std::cout << "---2 nikos" << std::endl;
211+
std::cout << "---2 nikos" << std::endl;
212212
if (seek_to_event_block_index(c.time_block_index) == Succeeded::no)
213213
return Succeeded::no;
214214

215215
// restore logical cursor
216216
curr_is_prompt = c.is_prompt;
217217
curr_event_in_event_block = c.event_in_block;
218218
m_time_block_index = c.time_block_index;
219-
std::cout << "---3 nikos" << std::endl;
219+
std::cout << "---3 nikos" << std::endl;
220220
if (c.has_cached_blocks)
221221
{
222222
this->curr_time_block = c.time_block;
223223
this->curr_event_block = c.event_block;
224224
}
225-
std::cout << "---4 nikos" << std::endl;
225+
std::cout << "---4 nikos" << std::endl;
226226
return Succeeded::yes;
227227
}
228228

src/listmode_buildblock/CListModeDataPETSIRD.cxx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ Coincidence LM Data Class for PETSIRD: Implementation
3131
#include "stir/info.h"
3232
#include "stir/error.h"
3333

34-
3534
// #include "petsird_helpers/create.h"
3635
// #include "petsird_helpers/geometry.h"
3736

@@ -40,7 +39,6 @@ Coincidence LM Data Class for PETSIRD: Implementation
4039

4140
START_NAMESPACE_STIR
4241

43-
4442
CListModeDataPETSIRD::CListModeDataPETSIRD(const std::string& listmode_filename, bool use_hdf5)
4543
: use_hdf5(use_hdf5)
4644
{
@@ -155,10 +153,10 @@ CListModeDataPETSIRD::get_next_record(CListRecord& record_of_general_type) const
155153
else
156154
{
157155
if (!current_lm_data_ptr->ReadTimeBlocks(curr_time_block))
158-
{
159-
current_lm_data_ptr->Close();
160-
return Succeeded::no;
161-
}
156+
{
157+
current_lm_data_ptr->Close();
158+
return Succeeded::no;
159+
}
162160
++m_time_block_index;
163161
curr_event_block = std::get<petsird::EventTimeBlock>(curr_time_block);
164162
}
@@ -167,10 +165,10 @@ CListModeDataPETSIRD::get_next_record(CListRecord& record_of_general_type) const
167165
{
168166
curr_is_prompt = true;
169167
if (!current_lm_data_ptr->ReadTimeBlocks(curr_time_block))
170-
{
171-
current_lm_data_ptr->Close();
172-
return Succeeded::no;
173-
}
168+
{
169+
current_lm_data_ptr->Close();
170+
return Succeeded::no;
171+
}
174172
++m_time_block_index;
175173
curr_event_block = std::get<petsird::EventTimeBlock>(curr_time_block);
176174
}

src/recon_buildblock/BinNormalisationFromPETSIRD.cxx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,11 @@ BinNormalisationFromPETSIRD::get_uncalibrated_bin_efficiency(const Bin& bin) con
7171

7272
DetectionPositionPair<> dp;
7373

74-
if (const auto* proj_cyl =
75-
dynamic_cast<const ProjDataInfoCylindricalNoArcCorr*>(proj_data_info_sptr.get()))
74+
if (const auto* proj_cyl = dynamic_cast<const ProjDataInfoCylindricalNoArcCorr*>(proj_data_info_sptr.get()))
7675
{
7776
proj_cyl->get_det_pos_pair_for_bin(dp, bin);
7877
}
79-
else if (const auto* proj_blk =
80-
dynamic_cast<const ProjDataInfoBlocksOnCylindricalNoArcCorr*>(proj_data_info_sptr.get()))
78+
else if (const auto* proj_blk = dynamic_cast<const ProjDataInfoBlocksOnCylindricalNoArcCorr*>(proj_data_info_sptr.get()))
8179
{
8280
proj_blk->get_det_pos_pair_for_bin(dp, bin);
8381
}
@@ -86,7 +84,6 @@ BinNormalisationFromPETSIRD::get_uncalibrated_bin_efficiency(const Bin& bin) con
8684
error("BinNormalisationFromPETSIRD: ProjDataInfo is neither Cylindrical nor BlocksOnCylindrical");
8785
}
8886

89-
9087
return petsird_info_sptr->get_detection_efficiency_for_bin(dp);
9188
}
9289

src/test/test_PETSIRDInfo_helpers.cxx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,14 @@ PETSIRDTests::test_find_unique_values_1D()
5555
std::vector<float> input = { 1.0f, 2.0f, 3.0f, 2.0f, 4.0f, 1.0f, 5.0f };
5656
std::set<float> expected = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f };
5757
std::set<float> result;
58-
58+
5959
stir::Array<1, float> _input(IndexRange<1>(7)); //{ 1.0f, 2.0f, 3.0f, 2.0f, 4.0f, 1.0f, 5.0f };
6060

61-
for (size_t i = 0; i < input.size(); ++i){
62-
_input[i] = input[i];
63-
std::cout << _input[i] << std::endl;
64-
}
61+
for (size_t i = 0; i < input.size(); ++i)
62+
{
63+
_input[i] = input[i];
64+
std::cout << _input[i] << std::endl;
65+
}
6566

6667
find_unique_values<float>(result, _input);
6768
for (const auto& val : expected)
@@ -76,16 +77,16 @@ PETSIRDTests::test_find_unique_values_2D()
7677
std::vector<std::vector<float>> input = { { 1.0f, 2.0f, 3.0f }, { 4.0f, 2.0f, 6.0f }, { 1.0f, 8.0f, 9.0f } };
7778
std::set<float> expected = { 1.0f, 2.0f, 3.0f, 4.0f, 6.0f, 8.0f, 9.0f };
7879
std::set<float> result;
79-
80+
8081
const IndexRange<2> range(Coordinate2D<int>(0, 0), Coordinate2D<int>(2, 2));
81-
stir::Array<2, float> _input(range); //{ { 1.0f, 2.0f, 3.0f }, { 4.0f, 2.0f, 6.0f }, { 1.0f, 8.0f, 9.0f } };
82+
stir::Array<2, float> _input(range); //{ { 1.0f, 2.0f, 3.0f }, { 4.0f, 2.0f, 6.0f }, { 1.0f, 8.0f, 9.0f } };
8283

8384
for (size_t i = 0; i < input.size(); ++i)
8485
for (size_t j = 0; j < input[i].size(); ++j)
8586
_input[i][j] = input[i][j];
8687

87-
find_unique_values<2, float>(result, _input);
88-
88+
find_unique_values<2, float>(result, _input);
89+
8990
for (const auto& val : expected)
9091
{
9192
this->check(result.find(val) != result.end(), fmt::format("Value {} should be in the unique set", val));

0 commit comments

Comments
 (0)