Skip to content

* Fixed mashing for even number of TOF bins. - #1755

Open
NikEfth wants to merge 1 commit into
masterfrom
fix_tof_mashing
Open

NikEfth wants to merge 1 commit into
masterfrom
fix_tof_mashing

Conversation

@NikEfth

@NikEfth NikEfth commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Changes in this pull request

This PR fixes #1751. With even number of TOF abs, naive inversion does not work. If even we need to subtract 1.
Now, both -1 and 0 become a mashed TOF bin 0 but they have inverted detectors.

Testing performed

New tests introduced to explicitly check the transformation with even and odd TOF bins, with and without mashing.

Related issues

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)

Contribution Notes

Please tick the following:

  • The content of this Pull Request (the Contribution) is intentionally submitted for inclusion in STIR (the Work) under the terms and conditions of the Apache-2.0 License.
  • I (or my institution) have signed the STIR Contribution License Agreement (not required for small changes).

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 6 duplication

Metric Results
Complexity 0
Duplication 6

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Comment thread src/include/stir/ProjDataInfoCylindricalNoArcCorr.inl

@KrisThielemans KrisThielemans left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As this correct?

You put in changes for even number tof bins, but the number of timing_pos could also be even. Do we cope with this? Same convention?

We want the dp.timing_pos correspond to the centre of the (mashed) TOF bin.

Examples that seem to give undesirable results

  • num_tof_bins is even
bin.timing_pos_num centred_range for bin centred_range for dp.timing_pos actual (asymmetric) range
0 0.5 0.5 * mash 0.5 * mash - 0.5

dp.timing_pos wouldn't be integer if mash is even

  • num_tof_bins is odd, but mash is even
bin.timing_pos_num centred_range for bin centred_range for dp.timing_pos actual (asymmetric) range
0 0 0 -0.5

@NikEfth

NikEfth commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator Author

I can simplify by droping the convention that dp should be positive. It won't fix everything though.

@KrisThielemans

Copy link
Copy Markdown
Collaborator

I don't think that the "positive dps" is the problem. At the moment, I only see the approach followed by @danieldeidda #1334 as correct.

From my table above, I think we should put in some run-time checks and call error if (scanner.num_tof_bins is even and TOF_mashing_factor>1), or (TOF_mashing_factor is even). That's still better than not allowing even TOF bins at all. (Maybe those restrictions can be relaxed a bit).

I'm not sure what you're testing at the moment. Do you test any of the above cases? Shouldn't the test not fail?

@NikEfth

NikEfth commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator Author

Now I cleanly test for more cases. Bear with me for a couple of days, please.

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

Labels

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

potential problems with even TOF bins and TOF mashing

3 participants