-
Notifications
You must be signed in to change notification settings - Fork 111
Allow even number of ToF bins #1334
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
base: master
Are you sure you want to change the base?
Changes from 5 commits
5bedd93
5b9d603
da07d94
e9ffdd4
c807500
605f950
fcfb1ca
3afc3fa
5cf36d9
ab7c5df
8246115
ab23474
ab7265d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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) | ||
|
|
@@ -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()); | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess the problem is happening in one of these modifications
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you paste some sample errors, for both TOF and non-TOF?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. WARNING: FactoryRegistry:: overwriting previous value of key in registry. INFO: Detected view-mashing factor 24 from the number of views (8) and the number of detectors per ring (384). INFO: Determined voxel size by dividing default_bin_size (3.12932) by zoom WARNING: Disabling symmetries as image is rotated due to phi offset of the scanner. Current bin: segment = -5, axial pos 0, view = 0, tangential_pos_num = -6, timing position index = 0 Current bin: segment = -5, axial pos 0, view = 0, tangential_pos_num = -3, timing position index = 0 Current bin: segment = -5, axial pos 1, view = 0, tangential_pos_num = -6, timing position index = 0 Current bin: segment = -5, axial pos 1, view = 0, tangential_pos_num = -3, timing position index = 0 Current bin: segment = -5, axial pos 2, view = 0, tangential_pos_num = -6, timing position index = 0 Current bin: segment = -5, axial pos 2, view = 0, tangential_pos_num = -3, timing position index = 0 Current bin: segment = -5, axial pos 3, view = 0, tangential_pos_num = -6, timing position index = 0 Current bin: segment = -5, axial pos 3, view = 0, tangential_pos_num = -3, timing position index = 0 Current bin: segment = -5, axial pos 4, view = 0, tangential_pos_num = -6, timing position index = 0 Current bin: segment = -5, axial pos 4, view = 0, tangential_pos_num = -3, timing position index = 0 |
||
| else | ||
| { | ||
| if (z_shift==0) | ||
|
|
@@ -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; } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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.
Outdated
|
||
| // KT 20/06/2001 disabled | ||
| //num_views_to_add=1; | ||
| this->proj_data_sptr.reset(); //MJ added | ||
|
|
@@ -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 | ||
|
|
@@ -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> | ||
|
|
@@ -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(); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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()); | ||
|
|
||
|
|
@@ -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.
Outdated
|
||
| 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); | ||
| } | ||
|
|
||
|
|
@@ -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.
|
||
| proj_data_sptr->get_max_tof_pos_num() - tof_bin_shift | ||
| ); | ||
|
|
||
|
|
||
|
|
@@ -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(); | ||
|
|
@@ -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(), | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.