Skip to content
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

View offset #181

Merged
merged 24 commits into from
Mar 5, 2021
Merged

View offset #181

merged 24 commits into from
Mar 5, 2021

Conversation

pwadhwa351
Copy link
Contributor

No description provided.

@NikEfth
Copy link
Collaborator

NikEfth commented May 1, 2018

@pw351 When you are finished pls let me know. :)

@pwadhwa351
Copy link
Contributor Author

I think I am done with the commits. :)

@NikEfth
Copy link
Collaborator

NikEfth commented May 2, 2018

This is wrong.
It includes parts of my changes. @pwadhwa351 Do the same thing but start from scratch. from a clean master. And do not give the same name twice.

@pwadhwa351
Copy link
Contributor Author

@NikEfth Can you please specify which changes you are referring to which you made?

@NikEfth
Copy link
Collaborator

NikEfth commented May 2, 2018

I should not be able to see this, from this branch :

commit b3a955831d9c6b5512e52c4910866e0ab09bfdee
Merge: 124e0889 cca8e608
Author: pw351 <pwadhwa351@gmail.com>
Date:   Fri Apr 27 15:33:02 2018 +0100

    Merge pull request #1 from NikEfth/Viewoffset
    
    Fixed all tests in test_proj_data_info with tilt (view_offset)

@KrisThielemans
Copy link
Collaborator

@NikEfth, I don't see that commit. In this PR, I see only 4 commits from @pwadhwa351. It restores the PR to what I remember. Possibly you have some links to the old PR? (not sure why thought. this is PR 181, the old one was #130)

@NikEfth
Copy link
Collaborator

NikEfth commented May 2, 2018

I can see that from
git log

@KrisThielemans
Copy link
Collaborator

not sure what you did then. you'd have to add a remote, fetch this new branch, and do a git log on that. I guess you might have merged onto an existing branch.
as far as I understand, the commits that I see on github are what's in this branch. (Would be really very surprising otherwise)

@NikEfth
Copy link
Collaborator

NikEfth commented May 2, 2018

Alright, I see now. so @pwadhwa351 and @pw351 are different accounts with the same brach ... ok

@NikEfth
Copy link
Collaborator

NikEfth commented May 2, 2018

OK, so let me explain the situation. I made two commits and a PR to Palak. Commit: ed71b4e and 0af0256.
In both make test succeeds but test_simulate_and_recon.sh fail for different reasons.
In the first commit the calculate_attenuation_coefficient fail because it needs --PMRT to run. Iterative reconstructions TESTS THAT USE PROJECTION MATRIX run smoothly and of course analytic fail.
In the second commit I added the PMRT flag but now I get a timeout on the Running precorrections.

I am sorry I will not be able to finish it this week.

@KrisThielemans
Copy link
Collaborator

I had a look at ed71b4e and added some comments there (not ideal but best I could do). There's a few small things I doubt that can be correct, but the main change here is that the code now takes the offset into account in the translation between views and detectors. I'm not sure if this is the best way though, see also my comment in the code.

I believe that changing the relation between views and detectors is dangerous though. It would have to be taken into account in any code for normalisation etc (detector efficiencies for the first and middle detector would now no longer correspond to the first view). I think that spreads things too far.

Instead, I believe it is better to use the following convention:

  • "continuous" coordinates such as phi and psi (the one (around the ring") are always in the standard coordinate system (with 0 being up or whatever it is).
  • "discrete" coordinates in bins always start from 0
  • we have a phi_offset (aka view_offset) and psi_offset (aka det_num_offset) such that
    • phi = phi_offset + view * view_increment
    • psi = psi_offset + det_num * det_num_increment

As long as these 2 offsets are consistent, we should be fine. Sadly, because of the interleaving, the relation between these 2 is maybe not trivial, but at least initially I'd vote for psi_offset = 2*phi_offset. That would be backwards compatible for the offset=0 case so probably our only possible choice.

In summary, I think we need a new function get_psi_offset (implemented in terms of the view offset), and used that in ProjDataInfoCylindericalNoArcCorr whereever we convert between psi and detx. I would hope that we don't need any other changes.

@KrisThielemans
Copy link
Collaborator

I've tried this and can confirm that for the arccorr case, there are round-trip problems, giving for instance

Error. round-trip get_LOR then get_bin (LORAs2Points): segment
        Problem at    segment = -15, axial pos 0, view = 177, tangential_pos_num = -31
        round-trip to segment = 15, axial pos 0, view = -15, tangential_pos_num = 31

showing that the view_num is negative, which shouldn't be the case. so we indeed need some of @NikEfth's fixes.

Previously, when calling the constructors, phi was required to be between 0 and pi, and psi between 0 and 2pi. This is no longer the case.
- make sure angles are first converted to a 0..2pi range
- introduce get_psi_offset for detector angles along the ring to be
consistent with view_offset (view_num=0 still corresponds to det_a==0)
revert to original version but using get_scanner_ptr() in derived classes
@KrisThielemans
Copy link
Collaborator

I've now added a few "modulo" operations (to_0_2pi) and then the get_psi_offset works. All test now work, except the analytic reconstructions as they use the incremental interpolating backprojector which doesn't take this into account. that'll be a pain.

thanks @NikEfth for the discussion on this!

@KrisThielemans KrisThielemans added this to the v4.1 milestone May 23, 2020
@KrisThielemans KrisThielemans modified the milestones: v4.1, v5.0 May 28, 2020
@KrisThielemans
Copy link
Collaborator

shifted to 5.0 as output will be incompatible for some scanners (with non-zero view-offset)

Also moved lines from ocumentation/release_3.1.htm to 5.0.htm
If intrinsic tilt would be very large or somehow bring the phi outside the range, the previous code presumably could go wrong
The interpolating backprojector doesn't support view-offset yet, so FBP tests failed.
We now run them on data with view-offset = 0.
@KrisThielemans
Copy link
Collaborator

KrisThielemans commented Dec 19, 2020

I've "fixed" the tests by running FBP on data with view-offset = 0. I expect this to work now.

Things to do:

  • check if the scatter code does the proper thing
  • make CMake option to disable view-offset, or change release notes

circumvent limitation of the interpolating backprojector
start-angle was supported for SPECT already long time ago.
When adding views, the view-offset should be adjusted to the average of the mashed views,
otherwise the image will be rotated.
As we now take view-mashing into account in view-offset, run_tests.sh was
failing as it compares with old reconstructions. So we change the header
to compensate.
The old code doesn't handle it, so we check upfront.

Also removed it from the recon_test_pack.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants