-
Notifications
You must be signed in to change notification settings - Fork 111
Modifications for psmr2024 #1430
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 6 commits
9e246fd
4634d30
4ba55e6
f5d663d
438be2f
0fb593d
7bf7e52
6aa04b0
5fa949c
e67faec
e7a2656
9179482
f7c15e6
a9c3ddb
005acb2
b7f727d
d8b3826
f17a7b0
619cc86
32dc591
fa21161
ead279e
205218d
eb31e8d
45a102c
7286488
e1438a8
60445db
7487039
055b17e
e11fbf9
2315597
9022195
f2f29bd
735e590
f3daa55
0be2403
db1d7b7
5864938
c813638
a7bbe64
58143b1
b7003ad
1f6f8c5
f4c1fb4
44af378
23be801
d6231b0
1180e45
4eac4ed
4439d5f
055f1c1
0d6516b
5c1af3f
a743a32
c05dc3e
da59b78
fc36235
21597d0
9162578
069231c
74fe00b
b297080
75b9d66
3b56f1a
c54c8a5
6c411d8
a455248
23cd5c4
9860aa3
e1149e2
14f3cea
2100f42
a5d816a
a22c45c
4aa5466
b1333e7
53c9d05
0c18fb6
9520af8
7eea917
d26b68a
34a35de
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 |
|---|---|---|
|
|
@@ -150,7 +150,9 @@ class ProjDataInfo | |
|
|
||
| //! Similar to create_shared_clone() but returns a non-tof version of ProjDataInfo setting tof mashing factor = 0 | ||
| inline shared_ptr<ProjDataInfo> create_non_tof_clone() const; | ||
|
|
||
| //! 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; | ||
|
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 suppose we need this for backwards compatibility? i.e. need to keep
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. Note: will be obsolete once we merge another PR on SSRB for TOF |
||
| //! Destructor | ||
| virtual ~ProjDataInfo() {} | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -83,6 +83,12 @@ class Succeeded; | |||||||||||||||||||||
| while others (such as CTI scanners) give only singles for a | ||||||||||||||||||||||
| collection of blocks. A \c singles_unit is then a set of crystals | ||||||||||||||||||||||
| for which we can get singles rates. | ||||||||||||||||||||||
| \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. | ||||||||||||||||||||||
|
NikEfth marked this conversation as resolved.
Outdated
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.
Suggested change
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| A further complication is that some scanners (including many Siemens scanners) | ||||||||||||||||||||||
| insert virtual crystals in the sinogram data (corresponding to gaps between | ||||||||||||||||||||||
|
|
@@ -168,6 +174,8 @@ class Scanner | |||||||||||||||||||||
| HZLR, | ||||||||||||||||||||||
| RATPET, | ||||||||||||||||||||||
| PANDA, | ||||||||||||||||||||||
| PSMR_3rings_scanner, | ||||||||||||||||||||||
| PSMR_3rings_scanner_TOF, | ||||||||||||||||||||||
| HYPERimage, | ||||||||||||||||||||||
| nanoPET, | ||||||||||||||||||||||
| HRRT, | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -280,14 +280,14 @@ PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin<Tar | |||||
| > 1)) // TODO this check needs to cover the case if we reconstruct only TOF bin 0 | ||||||
| { | ||||||
| // sets non-tof backprojector for sensitivity calculation (clone of the back_projector + set projdatainfo to non-tof) | ||||||
| this->sens_proj_data_info_sptr = this->proj_data_info_sptr->create_non_tof_clone(); | ||||||
| this->sens_proj_data_info_sptr = this->proj_data_info_sptr->create_single_tof_clone(); | ||||||
| // TODO disable caching of the matrix | ||||||
| this->sens_backprojector_sptr.reset(projector_pair_sptr->get_back_projector_sptr()->clone()); | ||||||
| this->sens_backprojector_sptr->set_up(this->sens_proj_data_info_sptr, target_sptr); | ||||||
| } | ||||||
| else | ||||||
| { | ||||||
| // just use the normal backprojector | ||||||
| // just use a signle TOF backprojector | ||||||
| this->sens_proj_data_info_sptr = this->proj_data_info_sptr; | ||||||
| this->sens_backprojector_sptr = projector_pair_sptr->get_back_projector_sptr(); | ||||||
| } | ||||||
|
|
@@ -622,60 +622,79 @@ PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin<Tar | |||||
| { | ||||||
| // TODO replace with call to distributable function | ||||||
|
|
||||||
| const int min_segment_num = this->proj_data_info_sptr->get_min_segment_num(); | ||||||
| const int max_segment_num = this->proj_data_info_sptr->get_max_segment_num(); | ||||||
|
|
||||||
| 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) | ||||||
|
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.
Suggested change
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. No, this is correct. Up to one TOF bin should not be considered TOF reconstruction.
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. still not with you on this one (i.e. with the 1). Why not say |
||||||
| error("TOF code for sensitivity needs work"); | ||||||
|
|
||||||
| this->sens_backprojector_sptr->start_accumulating_in_new_target(); | ||||||
|
|
||||||
| // warning: has to be same as subset scheme used as in distributable_computation | ||||||
| int runs = 1; | ||||||
|
|
||||||
| //TODO: For long scanners we should run better split this. - Let's discuss more. | ||||||
| // if((this->proj_data_info_sptr->get_max_segment_num() - | ||||||
| // this->proj_data_info_sptr->get_min_segment_num()) > 100) | ||||||
| // { | ||||||
| // runs = ceil(this->proj_data_info_sptr->get_max_segment_num() - | ||||||
| // this->proj_data_info_sptr->get_min_segment_num())/ 100; | ||||||
| // } | ||||||
|
|
||||||
| info(boost::format("The number of runs needed for the sensitivity image is %1%: ") % runs); | ||||||
|
|
||||||
| for (int run = 0; run < runs; ++run) | ||||||
| { | ||||||
| const int min_segment_num = this->proj_data_info_sptr->get_min_segment_num(); | ||||||
| const int max_segment_num = this->proj_data_info_sptr->get_max_segment_num(); | ||||||
| info(boost::format("Current run %1% of %2%: ") % run % runs); | ||||||
| // warning: has to be same as subset scheme used as in distributable_computation | ||||||
| #ifdef STIR_OPENMP | ||||||
| # if _OPENMP < 201107 | ||||||
| # pragma omp parallel for schedule(dynamic) | ||||||
| # else | ||||||
| # pragma omp parallel for collapse(2) schedule(dynamic) | ||||||
| # endif | ||||||
| #endif | ||||||
| for (int segment_num = min_segment_num; segment_num <= max_segment_num; ++segment_num) | ||||||
| { | ||||||
| for (int view = this->sens_proj_data_info_sptr->get_min_view_num() + subset_num; | ||||||
| view <= this->sens_proj_data_info_sptr->get_max_view_num(); | ||||||
| view += this->num_subsets) | ||||||
| for (int segment_num = min_segment_num; segment_num <= max_segment_num; ++segment_num) | ||||||
| { | ||||||
| const ViewSegmentNumbers view_segment_num(view, segment_num); | ||||||
| for (int view = this->sens_proj_data_info_sptr->get_min_view_num() + subset_num; | ||||||
| view <= this->sens_proj_data_info_sptr->get_max_view_num(); | ||||||
| view += this->num_subsets) | ||||||
| { | ||||||
| const ViewSegmentNumbers view_segment_num(view, segment_num); | ||||||
|
|
||||||
| if (!this->sens_backprojector_sptr->get_symmetries_used()->is_basic(view_segment_num)) | ||||||
| continue; | ||||||
| // for (int timing_pos_num = min_timing_pos_num; timing_pos_num <= max_timing_pos_num; ++timing_pos_num) | ||||||
| { | ||||||
| shared_ptr<DataSymmetriesForViewSegmentNumbers> symmetries_used( | ||||||
| this->sens_backprojector_sptr->get_symmetries_used()->clone()); | ||||||
| if (!this->sens_backprojector_sptr->get_symmetries_used()->is_basic(view_segment_num)) | ||||||
| continue; | ||||||
|
|
||||||
| info(boost::format("Current seg %1%, view: %1% ") % segment_num, view); | ||||||
| // for (int timing_pos_num = min_timing_pos_num; timing_pos_num <= max_timing_pos_num; ++timing_pos_num) | ||||||
| { | ||||||
| shared_ptr<DataSymmetriesForViewSegmentNumbers> symmetries_used( | ||||||
| this->sens_backprojector_sptr->get_symmetries_used()->clone()); | ||||||
|
|
||||||
| RelatedViewgrams<float> viewgrams = this->sens_proj_data_info_sptr->get_empty_related_viewgrams( | ||||||
| view_segment_num, symmetries_used, false); //, timing_pos_num); | ||||||
| RelatedViewgrams<float> viewgrams = this->sens_proj_data_info_sptr->get_empty_related_viewgrams( | ||||||
| view_segment_num, symmetries_used, false); //, timing_pos_num); | ||||||
|
|
||||||
| viewgrams.fill(1.F); | ||||||
| // find efficiencies | ||||||
| { | ||||||
| this->normalisation_sptr->undo(viewgrams); | ||||||
| } | ||||||
| // backproject | ||||||
| { | ||||||
| const int min_ax_pos_num = viewgrams.get_min_axial_pos_num(); | ||||||
| const int max_ax_pos_num = viewgrams.get_max_axial_pos_num(); | ||||||
| viewgrams.fill(1.F); | ||||||
| // find efficiencies | ||||||
| { | ||||||
| this->normalisation_sptr->undo(viewgrams); | ||||||
| } | ||||||
| // backproject | ||||||
| { | ||||||
| const int min_ax_pos_num = viewgrams.get_min_axial_pos_num(); | ||||||
| const int max_ax_pos_num = viewgrams.get_max_axial_pos_num(); | ||||||
|
|
||||||
| this->sens_backprojector_sptr->back_project(viewgrams, min_ax_pos_num, max_ax_pos_num); | ||||||
| this->sens_backprojector_sptr->back_project(viewgrams, min_ax_pos_num, max_ax_pos_num); | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| this->sens_backprojector_sptr->get_output(sensitivity); | ||||||
| // Next run | ||||||
| } | ||||||
| this->sens_backprojector_sptr->get_output(sensitivity); | ||||||
|
|
||||||
| } | ||||||
|
|
||||||
| template <typename TargetT> | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.