Skip to content

Conversation

@SomayehSaghamanesh
Copy link

@SomayehSaghamanesh SomayehSaghamanesh commented Sep 10, 2024

Changes in this pull request

Changed min/max_tang_pos_num definitions in two classes to be consistent with ProjDataInfo.cxx.

Testing performed

It is built successfully but fails in 8 tests (in make test). Probably needs more modification?
I could handle projection files with tang180 (with lm_to_projdata and convert_projdata_types) without error. Before implementing above changes, I got below error:
"ERROR: The tangential_pos range (-90 to 89) for this projection data is too large. Maximum supported range is from -89 to 90"

Related issues

#1507

Checklist before requesting a review

  • I have performed a self-review of my code
  • [] I have added docstrings/doxygen in line with the guidance in the developer guide
  • [] I have implemented unit tests that cover any new or modified functionality (if applicable)
  • The code builds and runs on my machine
  • [] documentation/release_XXX.md has been updated with any functionality change (if applicable)

@SomayehSaghamanesh SomayehSaghamanesh marked this pull request as ready for review February 11, 2025 09:00
Comment on lines +181 to +182
const int min_tang_pos_num = -(num_detectors / 2);
const int max_tang_pos_num = -(num_detectors / 2) + num_detectors - 1;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure about this. We have

uncompressed_view_tangpos_to_det1det2[v_num][tp_num].det1_num = (v_num + (tp_num >> 1) + num_detectors) % num_detectors;
uncompressed_view_tangpos_to_det1det2[v_num][tp_num].det2_num
= (v_num - ((tp_num + 1) >> 1) + num_detectors / 2) % num_detectors;

Subtracting

diff =  ((tp_num >> 1) + ((tp_num + 1) >> 1) + num_detectors/2 ) % num_detectors

Checking some examples (and relying on

BOOST_STATIC_ASSERT(-1 >> 1 == -1);
BOOST_STATIC_ASSERT(-2 >> 1 == -1);
, it transpires that this is equal to

diff =  (tp_num + num_detectors/2 ) % num_detectors

Therefore, setting tp_num = -(num_detectors/2) gives diff==0. On the other hand, using the current max_tang_pos_num also gives us diff==0. Both are "self-coincidences", which don't make a lot of sense.

It is probably ok to have a too large look-up table (although see this comment, but I think that if you're having this problem, your num_tangential_poss is too large. The max is num_detectors -1 really (which arguably we should check).

Copy link
Collaborator

@KrisThielemans KrisThielemans left a comment

Choose a reason for hiding this comment

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

I'm reluctant to merge this. If anything, we should keep the current max. However, this goes rather deep, and as you say 8 tests failed, I cannot see how we can merge as-is to cope with your case where num_tangential_poss=num_detectors_per_ring (which should mean that the first bin is always zero)

@KrisThielemans KrisThielemans mentioned this pull request Nov 12, 2025
3 tasks
@SomayehSaghamanesh
Copy link
Author

SomayehSaghamanesh commented Nov 12, 2025 via email

@KrisThielemans
Copy link
Collaborator

ok, I'm going to close this. Further comments on the trimming in #1563

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants