-
Notifications
You must be signed in to change notification settings - Fork 95
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
Modifications for psmr2024 #1430
base: master
Are you sure you want to change the base?
Conversation
A single TOF scanner can be used in the calculation of the sensitivity image, while applying the boundaries of the coincidence window.
* Building upon the cached lm reconstruction, we further parallelize the calculation of the sensitity image to muliple passes when the scanner is long. * Now, a scanner is TOF ready even if it does not have set timing resolution. If the timing resolution is 0 ps or if the TOF mashing leads to a scanner with 1 TOF bin then we apply boundaries on the LOR's length, equal to the coinc window. The probabilities do not change as we set them to 1. * cxx17 is nessesary for newer ROOT.
If this commit breaks many tests, I would consider it expected. |
|
||
//! Similar to create_non_tof_clone() but returns a single TOF version of the ProjDataInfo setting the TOF mashing factor sush that, | ||
//! a single TOF bin remains. This is usefull to apply the coincidence window boundaries without affecting the probabilities. | ||
inline shared_ptr<ProjDataInfo> create_single_tof_clone() const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose we need this for backwards compatibility? i.e. need to keep create_non_tof_clone
unmodified? If so, I'd be tempted to add a bool to create_non_tof_clone()
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: will be obsolete once we merge another PR on SSRB for TOF
info(boost::format("Calculating sensitivity for subset %1%") % subset_num); | ||
|
||
int min_timing_pos_num = use_tofsens ? this->proj_data_info_sptr->get_min_tof_pos_num() : 0; | ||
int max_timing_pos_num = use_tofsens ? this->proj_data_info_sptr->get_max_tof_pos_num() : 0; | ||
if (min_timing_pos_num < 0 || max_timing_pos_num > 0) | ||
if (min_timing_pos_num < 0 || max_timing_pos_num > 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (min_timing_pos_num < 0 || max_timing_pos_num > 1) | |
if (min_timing_pos_num < 0 || max_timing_pos_num > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is correct. Up to one TOF bin should not be considered TOF reconstruction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still not with you on this one (i.e. with the 1). Why not say num_timing_poss > 1
Co-authored-by: Kris Thielemans <[email protected]>
Co-authored-by: Kris Thielemans <[email protected]>
Co-authored-by: Kris Thielemans <[email protected]>
tests fail with
|
We can turn this to a warning, for now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more comments. Please merge master
as CI is currently not running due to a conflict.
src/include/stir/Scanner.h
Outdated
\li \c If the user set number for TOF positions to 1 and a bin size equal to the | ||
coincidence window then the reconstruction will essential be nonTOF but the | ||
projector will restrict the size of the LOR to the size of the coincidence window. | ||
\li \c The scanner will be classified as TOF enabled when the numer of TOF bins and | ||
TOF bin size are >1 and >0, respectively. If the energy resolution is not set that will be fine | ||
as long as the final TOF possitions is 1. Then we just restict the size of the LOR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\li \c If the user set number for TOF positions to 1 and a bin size equal to the | |
coincidence window then the reconstruction will essential be nonTOF but the | |
projector will restrict the size of the LOR to the size of the coincidence window. | |
\li \c The scanner will be classified as TOF enabled when the numer of TOF bins and | |
TOF bin size are >1 and >0, respectively. If the energy resolution is not set that will be fine | |
as long as the final TOF possitions is 1. Then we just restict the size of the LOR. | |
\li \c The scanner will be classified as TOF enabled when the number of TOF bins and | |
TOF bin size are >1 and >0, respectively. | |
\li \c If the user sets the number for TOF positions to 1, the TOF bin size should correspond to the size of the coincidence window. If the TOF timing resolution is zero, then the reconstruction will essentially be nonTOF but the | |
projector will restrict the length of the LOR according to the TOF bin width. |
info(boost::format("Calculating sensitivity for subset %1%") % subset_num); | ||
|
||
int min_timing_pos_num = use_tofsens ? this->proj_data_info_sptr->get_min_tof_pos_num() : 0; | ||
int max_timing_pos_num = use_tofsens ? this->proj_data_info_sptr->get_max_tof_pos_num() : 0; | ||
if (min_timing_pos_num < 0 || max_timing_pos_num > 0) | ||
if (min_timing_pos_num < 0 || max_timing_pos_num > 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still not with you on this one (i.e. with the 1). Why not say num_timing_poss > 1
Co-authored-by: Kris Thielemans <[email protected]>
Co-authored-by: Kris Thielemans <[email protected]>
I hadn't noticed that ... |
This will allow implementation specific tests for a particular prior.
- we were using abs() which (at least on some systems) converted to integers, giving the wrong result. now using std::abs() - introduce value/derivative_10 function for more concise code
now use INFINITY for second order derivatives, obtained by continuity
split the tests for the different priors in different classes, such that we can have specific tests for each. Currently, only added some for the RDP, including a Lipschitz test and limit for large values.
The RDP test was failing with eps=1.e-3, so now using 1.e-4
use double in neighbourhood calculations
previous version failed on macos-14-arm64. We have a very fragile list of checks. Presumably, CMake does a lot better, so use CMAKE_CXX_BYTE_ORDER in ByteOrderDefine (via config.h)
run clang-format on Ubuntu on ByteOrderDefine.h. Apparently, there was a version mismatch.
good catch. Another case for getting rid of this special handling relying on the generic one... |
@markus-jehl you're probably not able to, but in case you can, this PR should speed up the ML_norm code a fair amount, so you could potentially try that. It'd be good to have some reassurance on real data, as opposed to our simple test. |
use it as max
…smr2024' into modifications_for_psmr2024
c6337df
to
0c18fb6
Compare
@@ -14,6 +14,7 @@ View offset (degrees) := 0 | |||
Maximum number of (unmashed) TOF time bins := 5 | |||
Size of unmashed TOF time bins (ps) := 820.0 | |||
TOF timing resolution (ps) := 400.0 | |||
TOF mashing factor:= 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we shouldn't need to add this.
@@ -72,7 +72,7 @@ FilePath::is_directory() const | |||
struct stat info; | |||
|
|||
if (stat(my_string.c_str(), &info) != 0) | |||
error(boost::format("FilePath: Cannot access %1%.") % my_string); | |||
warning(boost::format("FilePath: Cannot access %1%.") % my_string); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did we make this change?
@@ -177,9 +177,46 @@ ProjDataInfo::set_tof_mash_factor(const int new_num) | |||
{ | |||
tof_mash_factor = new_num; | |||
if (tof_mash_factor > scanner_ptr->get_max_num_timing_poss()) | |||
error("ProjDataInfo::set_tof_mash_factor: TOF mashing factor (" + std::to_string(tof_mash_factor) | |||
{ | |||
warning("ProjDataInfo::set_tof_mash_factor: TOF mashing factor (" + std::to_string(tof_mash_factor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd still want an error here
+ +") must be smaller than or equal to the scanner's number of max timing bins (" | ||
+ std::to_string(scanner_ptr->get_max_num_timing_poss()) + ")."); | ||
} | ||
else if (tof_mash_factor == scanner_ptr->get_max_num_timing_poss()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's see what happens if we remove this special case, as it shouldn't be "special"
We need to preserve the TOF character, such that coincidence window etc is taken into account.
// if (check_scanner_match_geometry(error_str, this_scanner_sptr) == Succeeded::no) | ||
// { | ||
// error(error_str.c_str()); | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will have to re-enable this. Why did you need it?
src/recon_buildblock/ML_estimate_component_based_normalisation.cxx
Outdated
Show resolved
Hide resolved
src/recon_buildblock/ML_estimate_component_based_normalisation.cxx
Outdated
Show resolved
Hide resolved
src/recon_buildblock/ML_estimate_component_based_normalisation.cxx
Outdated
Show resolved
Hide resolved
src/recon_buildblock/ML_estimate_component_based_normalisation.cxx
Outdated
Show resolved
Hide resolved
src/recon_buildblock/ML_estimate_component_based_normalisation.cxx
Outdated
Show resolved
Hide resolved
src/recon_buildblock/ML_estimate_component_based_normalisation.cxx
Outdated
Show resolved
Hide resolved
@@ -21,6 +21,7 @@ set(${dir_EXE_SOURCES} | |||
manip_projdata.cxx | |||
display_projdata.cxx | |||
do_linear_regression.cxx | |||
construct_fanProjData_fromProjData |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please rename this file to save_FanProjData_from_ProjData
ac803dd
to
d26b68a
Compare
Ubuntu clang job fails with
Potentially related to https://gitlab.kitware.com/cmake/cmake/-/issues/23021 but it's weird |
|
|
Linking problem was fixed in #1449 which has taken the sum/find_min/max parallelisation commits, and is now merged to master, so I've merged that back on here. I suggest we split this PR in 2: one for the sensitivity calculation, and one for the parallelisation of the norm code. We can do that again by cherry-picking relevant commits. Maybe we can resolve things here first though, as you prefer. |
Changes in this pull request
Testing performed
Related issues
Checklist before requesting a review
documentation/release_XXX.md
has been updated with any functionality change (if applicable)