Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow even number of ToF bins #1334

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
13 changes: 5 additions & 8 deletions src/buildblock/ProjDataInfo.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,7 @@ START_NAMESPACE_STIR
float
ProjDataInfo::get_k(const Bin& bin) const
{
if (!(num_tof_bins%2))
return bin.timing_pos_num() * tof_increament_in_mm + tof_increament_in_mm / 2.f;
else
return (bin.timing_pos_num() * tof_increament_in_mm);
return (bin.timing_pos_num() - (num_tof_bins-1)/2.f)* tof_increament_in_mm ;
}

double
Expand Down Expand Up @@ -229,14 +226,14 @@ ProjDataInfo::set_tof_mash_factor(const int new_num)
tof_increament_in_mm = tof_delta_time_to_mm(tof_mash_factor * scanner_ptr->get_size_of_timing_pos());

// TODO cope with even numbers!
min_tof_pos_num = - (scanner_ptr->get_max_num_timing_poss() / tof_mash_factor)/2;
max_tof_pos_num = min_tof_pos_num + (scanner_ptr->get_max_num_timing_poss() / tof_mash_factor) -1;
min_tof_pos_num = 0;//- (scanner_ptr->get_max_num_timing_poss() / tof_mash_factor)/2;
max_tof_pos_num = (scanner_ptr->get_max_num_timing_poss() / tof_mash_factor)-1 ;//min_tof_pos_num + (scanner_ptr->get_max_num_timing_poss() / tof_mash_factor) -1;

num_tof_bins = max_tof_pos_num - min_tof_pos_num +1 ;

// Ensure that we have a central tof bin.
if (num_tof_bins%2 == 0)
error("ProjDataInfo: Number of TOF bins should be an odd number. Abort.");
// if (num_tof_bins%2 == 0)
// error("ProjDataInfo: Number of TOF bins should be an odd number. Abort.");

// Upper and lower boundaries of the timing poss;
tof_bin_boundaries_mm.grow(min_tof_pos_num, max_tof_pos_num);
Expand Down
4 changes: 2 additions & 2 deletions src/buildblock/ProjDataInfoCylindrical.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -588,13 +588,13 @@ get_LOR(LORInAxialAndNoArcCorrSinogramCoordinates<float>& lor,
const float z1 = (m_in_mm - max_a*tantheta);
const float z2 = (m_in_mm - min_a*tantheta);

const bool swap = false;//get_tof_delta_time(bin)<0;
lor =
LORInAxialAndNoArcCorrSinogramCoordinates<float>(z1, z2,
phi,
asin(s_in_mm/get_ring_radius()),
get_ring_radius(),
false);// needs to set "swapped" to false given above code
swap);// needs to set "swapped" to false given above code
}

#if 0
Expand Down
20 changes: 12 additions & 8 deletions src/buildblock/ProjDataInfoCylindricalNoArcCorr.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ get_num_det_pos_pairs_for_bin(const Bin& bin, bool ignore_non_spatial_dimensions
{
return
get_num_ring_pairs_for_segment_axial_pos_num(bin.segment_num(),
bin.axial_pos_num())*
bin.axial_pos_num())*
get_view_mashing_factor()*
(ignore_non_spatial_dimensions ? 1 : std::max(1,get_tof_mash_factor()));
}
Expand Down Expand Up @@ -368,8 +368,9 @@ get_all_det_pos_pairs_for_bin(vector<DetectionPositionPair<> >& dps,
// not sure how to handle even tof mashing
assert(!is_tof_data() || (get_tof_mash_factor() % 2 == 1)); // TODOTOF
// we will need to add all (unmashed) timing_pos for the current bin
min_timing_pos_num = bin.timing_pos_num()*get_tof_mash_factor() - (get_tof_mash_factor() / 2);
max_timing_pos_num = bin.timing_pos_num()*get_tof_mash_factor() + (get_tof_mash_factor() / 2);
min_timing_pos_num = bin.timing_pos_num()*get_tof_mash_factor();//bin.timing_pos_num()*get_tof_mash_factor() - (get_tof_mash_factor() / 2);
max_timing_pos_num = bin.timing_pos_num()*get_tof_mash_factor() + (get_tof_mash_factor());//bin.timing_pos_num()*get_tof_mash_factor() + (get_tof_mash_factor() / 2);

}

unsigned int current_dp_num=0;
Expand All @@ -393,6 +394,7 @@ get_all_det_pos_pairs_for_bin(vector<DetectionPositionPair<> >& dps,
dps[current_dp_num].pos2().tangential_coord() = det2_num;
dps[current_dp_num].pos2().axial_coord() = rings_iter->second;
dps[current_dp_num].timing_pos() = uncompressed_timing_pos_num;

++current_dp_num;
}
}
Expand Down Expand Up @@ -500,8 +502,8 @@ find_cartesian_coordinates_given_scanner_coordinates (CartesianCoordinate3D<floa
const int num_detectors_per_ring =
get_scanner_ptr()->get_num_detectors_per_ring();

int d1, d2, r1, r2;
int tpos = timing_pos_num;

int d1, d2, r1, r2, tpos;

this->initialise_det1det2_to_uncompressed_view_tangpos_if_not_done_yet();

Expand All @@ -511,14 +513,15 @@ find_cartesian_coordinates_given_scanner_coordinates (CartesianCoordinate3D<floa
d2 = det1;
r1 = Ring_B;
r2 = Ring_A;
tpos *= -1;
tpos=get_max_tof_pos_num()-timing_pos_num;
}
else
{
d1 = det1;
d2 = det2;
r1 = Ring_A;
r2 = Ring_B;
tpos=timing_pos_num;
}

#if 0
Expand Down Expand Up @@ -549,8 +552,9 @@ find_cartesian_coordinates_given_scanner_coordinates (CartesianCoordinate3D<floa
coord_2 = lor.p2();

#endif
if (tpos < 0)
std::swap(coord_1, coord_2);

if (tpos -get_max_tof_pos_num()/2.F < 0)
std::swap(coord_1, coord_2);
}

void
Expand Down
6 changes: 3 additions & 3 deletions src/include/stir/ProjDataInfoCylindricalNoArcCorr.inl
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ get_bin_for_det_pair(Bin& bin,
}
else
{
bin.timing_pos_num() = -timing_pos_num;
bin.timing_pos_num() = get_max_tof_pos_num()-timing_pos_num;
return get_segment_axial_pos_num_for_ring_pair(bin.segment_num(), bin.axial_pos_num(), ring_num2, ring_num1);
}
}
Expand All @@ -156,7 +156,7 @@ get_bin_for_det_pos_pair(Bin& bin,
dp.pos2().axial_coord(),
this->get_tof_mash_factor()==0
? 0 // use timing_pos==0 in the nonTOF case
: stir::round((float)dp.timing_pos()/this->get_tof_mash_factor()));
: (int)((float)dp.timing_pos()/this->get_tof_mash_factor()));
danieldeidda marked this conversation as resolved.
Show resolved Hide resolved
}
void
ProjDataInfoCylindricalNoArcCorr::
Expand Down Expand Up @@ -189,7 +189,7 @@ get_det_pos_pair_for_bin(
//lousy work around because types don't match (short/int). TODO remove!
int t1, a1, t2, a2;
get_det_pair_for_bin(t1, a1, t2, a2, bin);
if (bin.timing_pos_num()>=0)
if (bin.timing_pos_num()-get_max_tof_pos_num()/2.F>=0)
{
dp.pos1().tangential_coord()=t1;
dp.pos1().axial_coord()=a1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ find_sym_op_general_bin(
if ( !do_symmetry_swap_segment || segment_num > 0)
{
if ( do_symmetry_swap_s && s < 0)
return new SymmetryOperation_PET_CartesianGrid_swap_xmx_ymy_zq(view180, axial_pos_shift, z_shift, transform_z);
return new SymmetryOperation_PET_CartesianGrid_swap_xmx_ymy_zq(view180, axial_pos_shift, z_shift, transform_z, proj_data_info_ptr->get_scanner_ptr()->get_max_num_timing_poss());
else
{
if (z_shift==0)
Expand All @@ -369,13 +369,13 @@ find_sym_op_general_bin(
return new SymmetryOperation_PET_CartesianGrid_swap_zq(view180, axial_pos_shift, z_shift, transform_z);
else*/
if ( do_symmetry_swap_s && s < 0)
return new SymmetryOperation_PET_CartesianGrid_swap_xmx_ymy(view180, axial_pos_shift, z_shift);
return new SymmetryOperation_PET_CartesianGrid_swap_xmx_ymy(view180, axial_pos_shift, z_shift, proj_data_info_ptr->get_scanner_ptr()->get_max_num_timing_poss());
else
return new SymmetryOperation_PET_CartesianGrid_swap_zq(view180, axial_pos_shift, z_shift, transform_z); // s > 0
}
else // segment_num = 0
{
if ( do_symmetry_swap_s && s < 0) return new SymmetryOperation_PET_CartesianGrid_swap_xmx_ymy(view180, axial_pos_shift, z_shift);
if ( do_symmetry_swap_s && s < 0) return new SymmetryOperation_PET_CartesianGrid_swap_xmx_ymy(view180, axial_pos_shift, z_shift, proj_data_info_ptr->get_scanner_ptr()->get_max_num_timing_poss());
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the problem is happening in one of these modifications

Copy link
Collaborator Author

@danieldeidda danieldeidda Jan 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually not sure anymore because the test is giving errors when the 2 bins are actually the same. also it happens for a non-tof test

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you paste some sample errors, for both TOF and non-TOF?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: FactoryRegistry:: overwriting previous value of key in registry.
key: None
Tests for DataSymmetriesForBins_PET_CartesianGrid
Testing span=1

INFO: Detected view-mashing factor 24 from the number of views (8) and the number of detectors per ring (384).
Adjusting the azimuthal angle offset accordingly (an extra offset of 10.7813 degrees)
Tests with usual image size

INFO: Determined voxel size by dividing default_bin_size (3.12932) by zoom
Testing with all symmetries

WARNING: Disabling symmetries as image is rotated due to phi offset of the scanner.
Error. Comparing symmetry bin configuration

Current bin: segment = -5, axial pos 0, view = 0, tangential_pos_num = -6, timing position index = 0
Symm bin: segment = -5, axial pos 0, view = 0, tangential_pos_num = -6, timing position index = 0
Error. Comparing symmetry bin configuration

Current bin: segment = -5, axial pos 0, view = 0, tangential_pos_num = -3, timing position index = 0
Symm bin: segment = -5, axial pos 0, view = 0, tangential_pos_num = -3, timing position index = 0
Error. Comparing symmetry bin configuration

Current bin: segment = -5, axial pos 1, view = 0, tangential_pos_num = -6, timing position index = 0
Symm bin: segment = -5, axial pos 1, view = 0, tangential_pos_num = -6, timing position index = 0
Error. Comparing symmetry bin configuration

Current bin: segment = -5, axial pos 1, view = 0, tangential_pos_num = -3, timing position index = 0
Symm bin: segment = -5, axial pos 1, view = 0, tangential_pos_num = -3, timing position index = 0
Error. Comparing symmetry bin configuration

Current bin: segment = -5, axial pos 2, view = 0, tangential_pos_num = -6, timing position index = 0
Symm bin: segment = -5, axial pos 2, view = 0, tangential_pos_num = -6, timing position index = 0
Error. Comparing symmetry bin configuration

Current bin: segment = -5, axial pos 2, view = 0, tangential_pos_num = -3, timing position index = 0
Symm bin: segment = -5, axial pos 2, view = 0, tangential_pos_num = -3, timing position index = 0
Error. Comparing symmetry bin configuration

Current bin: segment = -5, axial pos 3, view = 0, tangential_pos_num = -6, timing position index = 0
Symm bin: segment = -5, axial pos 3, view = 0, tangential_pos_num = -6, timing position index = 0
Error. Comparing symmetry bin configuration

Current bin: segment = -5, axial pos 3, view = 0, tangential_pos_num = -3, timing position index = 0
Symm bin: segment = -5, axial pos 3, view = 0, tangential_pos_num = -3, timing position index = 0
Error. Comparing symmetry bin configuration

Current bin: segment = -5, axial pos 4, view = 0, tangential_pos_num = -6, timing position index = 0
Symm bin: segment = -5, axial pos 4, view = 0, tangential_pos_num = -6, timing position index = 0
Error. Comparing symmetry bin configuration

Current bin: segment = -5, axial pos 4, view = 0, tangential_pos_num = -3, timing position index = 0
Symm bin: segment = -5, axial pos 4, view = 0, tangential_pos_num = -3, timing position index = 0

else
{
if (z_shift==0)
Expand Down Expand Up @@ -484,7 +484,7 @@ find_basic_bin(int &segment_num, int &view_num, int &axial_pos_num, int &tangent
{
//when swap_s, must invert timing pos for lor probs. Symmetry operation should correct bin
tangential_pos_num *= -1;
timing_pos_num *= -1;
timing_pos_num = proj_data_info_ptr->get_max_tof_pos_num() - timing_pos_num;
change=true;
}
if ( do_symmetry_shift_z && axial_pos_num != 0 ) { axial_pos_num = 0; change = true; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public RegisteredParsingObject<PoissonLogLikelihoodWithLinearModelForMeanAndPro
const ProjData& get_proj_data() const;
const shared_ptr<ProjData>& get_proj_data_sptr() const;
const int get_max_segment_num_to_process() const;
const int get_max_timing_pos_num_to_process() const;
const int get_max_num_central_timing_poss_to_process() const;
const bool get_zero_seg0_end_planes() const;
const ProjData& get_additive_proj_data() const;
const shared_ptr<ProjData>& get_additive_proj_data_sptr() const;
Expand All @@ -201,7 +201,7 @@ public RegisteredParsingObject<PoissonLogLikelihoodWithLinearModelForMeanAndPro
int set_num_subsets(const int num_subsets);
void set_proj_data_sptr(const shared_ptr<ProjData>&);
void set_max_segment_num_to_process(const int);
void set_max_timing_pos_num_to_process(const int);
void set_max_num_central_timing_poss_to_process(const int);
void set_zero_seg0_end_planes(const bool);
//N.E. Changed to ExamData
virtual void set_additive_proj_data_sptr(const shared_ptr<ExamData>&);
Expand Down Expand Up @@ -311,7 +311,8 @@ public RegisteredParsingObject<PoissonLogLikelihoodWithLinearModelForMeanAndPro

//! the maximum absolute time-of-flight bin number to use in the reconstruction
/*! convention: if -1, use get_max_tof_pos_num()*/
int max_timing_pos_num_to_process;
int max_num_central_timing_poss_to_process;
int tof_bin_shift;

/**********************/
ParseAndCreateFrom<TargetT, ProjData> target_parameter_parser;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,8 @@ class SymmetryOperation_PET_CartesianGrid_swap_xmx_ymy_zq : public SymmetryOpera
private:
typedef SymmetryOperation_PET_CartesianGrid_swap_xmx_ymy_zq self;
public:
SymmetryOperation_PET_CartesianGrid_swap_xmx_ymy_zq(const int num_views, const int axial_pos_shift, const int z_shift, const int q)
: view180(num_views), axial_pos_shift(axial_pos_shift), z_shift(z_shift), q(q)
SymmetryOperation_PET_CartesianGrid_swap_xmx_ymy_zq(const int num_views, const int axial_pos_shift, const int z_shift, const int q, const int max_tof_pos_num)
: view180(num_views), axial_pos_shift(axial_pos_shift), z_shift(z_shift), q(q), timing_shift(max_tof_pos_num)
{}

inline void
Expand All @@ -364,6 +364,7 @@ class SymmetryOperation_PET_CartesianGrid_swap_xmx_ymy_zq : public SymmetryOpera
int axial_pos_shift;
int z_shift;
int q;
int timing_shift;
};

class SymmetryOperation_PET_CartesianGrid_swap_xy_ymx_zq : public SymmetryOperation
Expand Down Expand Up @@ -497,8 +498,8 @@ class SymmetryOperation_PET_CartesianGrid_swap_xmx_ymy : public SymmetryOperatio
private:
typedef SymmetryOperation_PET_CartesianGrid_swap_xmx_ymy self;
public:
SymmetryOperation_PET_CartesianGrid_swap_xmx_ymy(const int num_views, const int axial_pos_shift, const int z_shift)
: view180(num_views), axial_pos_shift(axial_pos_shift), z_shift(z_shift)
SymmetryOperation_PET_CartesianGrid_swap_xmx_ymy(const int num_views, const int axial_pos_shift, const int z_shift, const int max_tof_pos_num)
: view180(num_views), axial_pos_shift(axial_pos_shift), z_shift(z_shift), timing_shift(max_tof_pos_num)
{}

inline void
Expand All @@ -521,6 +522,7 @@ class SymmetryOperation_PET_CartesianGrid_swap_xmx_ymy : public SymmetryOperatio
int view180;
int axial_pos_shift;
int z_shift;
int timing_shift;
};

class SymmetryOperation_PET_CartesianGrid_swap_xmy_ymx_zq : public SymmetryOperation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ SymmetryOperation_PET_CartesianGrid_swap_xmx_ymy_zq::
{
b.axial_pos_num() += axial_pos_shift;
b.tangential_pos_num() *= -1;
b.timing_pos_num() *= -1;
b.timing_pos_num() = timing_shift - b.timing_pos_num();
}

void
Expand Down Expand Up @@ -553,7 +553,7 @@ SymmetryOperation_PET_CartesianGrid_swap_xmx_ymy::
b.axial_pos_num() += axial_pos_shift;
b.segment_num() *= -1;
b.tangential_pos_num() *= -1;
b.timing_pos_num() *= -1;
b.timing_pos_num() = timing_shift - b.timing_pos_num();
}
void
SymmetryOperation_PET_CartesianGrid_swap_xmx_ymy::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ set_defaults()

this->input_filename="";
this->max_segment_num_to_process=-1;
this->max_timing_pos_num_to_process=0;
this->max_num_central_timing_poss_to_process=0;
danieldeidda marked this conversation as resolved.
Show resolved Hide resolved
// KT 20/06/2001 disabled
//num_views_to_add=1;
this->proj_data_sptr.reset(); //MJ added
Expand Down Expand Up @@ -324,8 +324,8 @@ get_max_segment_num_to_process() const
template <typename TargetT>
const int
PoissonLogLikelihoodWithLinearModelForMeanAndProjData<TargetT>::
get_max_timing_pos_num_to_process() const
{ return this->max_timing_pos_num_to_process; }
get_max_num_central_timing_poss_to_process() const
{ return this->max_num_central_timing_poss_to_process; }

template <typename TargetT>
const bool
Expand Down Expand Up @@ -415,9 +415,9 @@ set_max_segment_num_to_process(const int arg)
template<typename TargetT>
void
PoissonLogLikelihoodWithLinearModelForMeanAndProjData<TargetT>::
set_max_timing_pos_num_to_process(const int arg)
set_max_num_central_timing_poss_to_process(const int arg)
{
this->max_timing_pos_num_to_process = arg;
this->max_num_central_timing_poss_to_process = arg;
}

template<typename TargetT>
Expand Down Expand Up @@ -605,8 +605,11 @@ set_up_before_sensitivity(shared_ptr<const TargetT > const& target_sptr)
return Succeeded::no;
}

this->max_timing_pos_num_to_process =
this->proj_data_sptr->get_max_tof_pos_num();
this->max_num_central_timing_poss_to_process =
this->proj_data_sptr->get_max_tof_pos_num();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think is wrong, it probably needs a divide by 2 or so

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mh not sure than the shift is different then zero if we want to use them all

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in fact, we don't support this yet, but having wrong code is a bad idea. Add a comment and throw an error if the argument isn't what we expect?

However, it seems hard to know what the argument should be. For 2 TOF bins, the max number of central should be 1. For 3 TOF bins, it should also be 1.5... (1 could work, but how would one say then we only want to do the central one). Looks like the name is still wrong.

Or remove...

// The following "shift"is used to estimate the maximum and minimum tof position number to process
// i.e. min_pos= num_tof_bins+shift and max_pos= num_tof_bins-shift if we use all than shift =0
this->tof_bin_shift = (proj_data_sptr->get_num_tof_poss()-this->max_num_central_timing_poss_to_process)/2;

shared_ptr<ProjDataInfo> proj_data_info_sptr(this->proj_data_sptr->get_proj_data_info_sptr()->clone());

Expand Down Expand Up @@ -729,15 +732,15 @@ actual_compute_subset_gradient_without_penalty(TargetT& gradient,
this->proj_data_sptr,
subset_num,
this->num_subsets,
-this->max_segment_num_to_process,
0,
danieldeidda marked this conversation as resolved.
Show resolved Hide resolved
this->max_segment_num_to_process,
this->zero_seg0_end_planes!=0,
NULL,
this->additive_proj_data_sptr,
this->normalisation_sptr,
caching_info_ptr,
-this->max_timing_pos_num_to_process,
this->max_timing_pos_num_to_process,
proj_data_sptr->get_min_tof_pos_num() + tof_bin_shift,
proj_data_sptr->get_max_tof_pos_num() - tof_bin_shift,
add_sensitivity);
}

Expand Down Expand Up @@ -780,8 +783,8 @@ actual_compute_objective_function_without_penalty(const TargetT& current_estimat
this->get_time_frame_definitions().get_start_time(this->get_time_frame_num()),
this->get_time_frame_definitions().get_end_time(this->get_time_frame_num()),
this->caching_info_ptr,
-this->max_timing_pos_num_to_process,
this->max_timing_pos_num_to_process
proj_data_sptr->get_min_tof_pos_num() + tof_bin_shift,
danieldeidda marked this conversation as resolved.
Show resolved Hide resolved
proj_data_sptr->get_max_tof_pos_num() - tof_bin_shift
);


Expand All @@ -796,10 +799,11 @@ sum_projection_data() const
{

float counts=0.0F;

int min_timing_poss_to_process = proj_data_sptr->get_min_tof_pos_num() + tof_bin_shift;
int max_timing_poss_to_process = proj_data_sptr->get_max_tof_pos_num() - tof_bin_shift;
for (int segment_num = -max_segment_num_to_process; segment_num <= max_segment_num_to_process; ++segment_num)
{
for (int timing_pos_num = -max_timing_pos_num_to_process; timing_pos_num <= max_timing_pos_num_to_process; ++timing_pos_num)
for (int timing_pos_num = min_timing_poss_to_process; timing_pos_num <= max_timing_poss_to_process; ++timing_pos_num)
{
for (int view_num = proj_data_sptr->get_min_view_num();
view_num <= proj_data_sptr->get_max_view_num();
Expand Down Expand Up @@ -892,8 +896,8 @@ add_subset_sensitivity(TargetT& sensitivity, const int subset_num) const
this->get_time_frame_definitions().get_start_time(this->get_time_frame_num()),
this->get_time_frame_definitions().get_end_time(this->get_time_frame_num()),
this->caching_info_ptr,
use_tofsens ? -this->max_timing_pos_num_to_process : 0,
use_tofsens ? this->max_timing_pos_num_to_process : 0);
use_tofsens ? proj_data_sptr->get_min_tof_pos_num() + tof_bin_shift : 0,
use_tofsens ? proj_data_sptr->get_max_tof_pos_num() - tof_bin_shift : 0);

std::transform(sensitivity.begin_all(), sensitivity.end_all(),
sensitivity_this_subset_sptr->begin_all(), sensitivity.begin_all(),
Expand Down
6 changes: 3 additions & 3 deletions src/test/test_proj_data_info.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ ProjDataInfoTests::test_generic_proj_data_info(ProjDataInfo& proj_data_info)
"check on min/max_tangential_pos_num being (almost) centred");
check_if_equal(proj_data_info.get_max_tof_pos_num() - proj_data_info.get_min_tof_pos_num() + 1,
proj_data_info.get_num_tof_poss(), "basic check on min/max/num_tof_pos_num");
check_if_equal(proj_data_info.get_max_tof_pos_num() + proj_data_info.get_min_tof_pos_num(), 0,
check_if_equal(proj_data_info.get_max_tof_pos_num() + proj_data_info.get_min_tof_pos_num(), proj_data_info.get_max_tof_pos_num(),
"check on min/max_tof_pos_num being (almost) centred");
danieldeidda marked this conversation as resolved.
Show resolved Hide resolved
check_if_equal(proj_data_info.get_max_view_num() - proj_data_info.get_min_view_num() + 1, proj_data_info.get_num_views(),
"basic check on min/max/num_view_num");
Expand Down Expand Up @@ -236,7 +236,7 @@ ProjDataInfoTests::test_generic_proj_data_info(ProjDataInfo& proj_data_info)
|| !check(diff_view_num <= 1, "round-trip get_LOR then get_bin: view")
|| !check(diff_axial_pos_num <= 1, "round-trip get_LOR then get_bin: axial_pos")
|| !check(diff_tangential_pos_num <= 1, "round-trip get_LOR then get_bin: tangential_pos")
|| !check(diff_timing_pos_num == 0, "round-trip get_LOR then get_bin: timing_pos"))
|| !check(diff_timing_pos_num == 0 || diff_timing_pos_num == proj_data_info.get_max_tof_pos_num() , "round-trip get_LOR then get_bin: timing_pos"))
KrisThielemans marked this conversation as resolved.
Show resolved Hide resolved

#else
if (!check(org_bin == new_bin, "round-trip get_LOR then get_bin"))
Expand Down Expand Up @@ -293,7 +293,7 @@ ProjDataInfoTests::test_generic_proj_data_info(ProjDataInfo& proj_data_info)
|| !check(diff_view_num <= 1, "round-trip get_LOR then get_bin (LORAs2Points): view")
|| !check(diff_axial_pos_num <= 1, "round-trip get_LOR then get_bin (LORAs2Points): axial_pos")
|| !check(diff_tangential_pos_num <= 1, "round-trip get_LOR then get_bin (LORAs2Points): tangential_pos")
|| !check(diff_timing_pos_num == 0, "round-trip get_LOR then get_bin: timing_pos"))
|| !check(diff_timing_pos_num == 0 || diff_timing_pos_num == proj_data_info.get_max_tof_pos_num(), "round-trip get_LOR then get_bin: timing_pos"))
KrisThielemans marked this conversation as resolved.
Show resolved Hide resolved

#else
if (!check(org_bin == new_bin, "round-trip get_LOR then get_bin"))
Expand Down
Loading
Loading