-
Notifications
You must be signed in to change notification settings - Fork 100
Reinvert spect axis #1631
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?
Reinvert spect axis #1631
Conversation
|
Did you run the It's possible that the SRT2DSPECT code needs adaptation. @Dimitra-Kyriakopoulou in our current SPECT projector, the "x" (i.e. horizontal) axis is flipped between emission and attenuation. This PR fixes this. Not sure if you had modified your code to be compatible with the STIR SPECTUB projector. |
|
no sorry i didn't have STIR installed. I'll check on another PC |
|
Dear Professor @KrisThielemans, I) As long as line 113 of the current simulate_data_for_test.sh in master the SRT2DSPECT error should not exist any more. II) I cannot test it immediately now, as the inversion is not in master; but if the error is not corrected, i will add in the GRD2D-DDSR2D repository the inversion changes to test it. III) What are further redundant and need to be removed -but do not affect the tests- are:
I am really sorry for the late reply, |
OK thanks Dimitra, I will have a look |
|
@KrisThielemans is there a way to see this log file? "There were errors. Check my_SRT2DSPECT_test_sim.par_SPECT.log" I don't seem to be bale to download the artifacts |
|
Dear @danieldeidda, Kind regards, |
go to the "summary" page of the run of the action (in this case, https://github.com/UCL/STIR/actions/runs/18588852662?pr=1631). scrolldown a bit. There's zip files with all logs. |
|
Hi, |
|
As this is a test that says "do I get the same as before",we should
so I think this needs
This test doesn't check SRT2DSPECT, so no changes for Dimitra. On the other hand, we have `run_test_simulate_and_recon.sh, which first simulates some data
|
|
Dear Professor @KrisThielemans and @danieldeidda, II) I agree with Professor Thielemans' proposal. In addition, I would like to express a few thoughts that came to my mind regarding the 90 degree rotation and z-flip issues, which can appear as the current left–right (x) problem: A) src/IO/InterfilePDFSHeaderSPECT.cxx Different datasets may use different 0° definitions and CW/CCW sense. That creates a global rotation (often ~90°) which can be misread as “left/right” mismatch. Hence, right after the add_key(...) calls, we must normalize angles to one convention (0°=+x, CCW, positive increment). If already canonical, it’s a no-op; otherwise it corrects once and removes rotation ambiguity. B) src/recon_buildblock/ProjMatrixByBinSPECTUB.cxx Some images arrive with opposite z slice order . That appears as a z-mirror during comparison and can confuse left/right assessments. At image load (or just before the projector binds the C) src/recon_buildblock/SPECTUB_Tools.cxx If (A) isn’t normalized, We must ensure
D) src/recon_buildblock/SPECTUB_Weight3d.cxx If z-order is normalized once at (B), D is automatically correct for all cases. |
|
Thanks @Dimitra-Kyriakopoulou. These are good points, but I think they belong in a new issue, not in a comment in this (intentionally very small) PR which attempts to fix the SPECTUB projector and hence all iterative algorithms. I've created #1635 for that. |
|
|
|
Clean-up:
|
documentation/release_6.3.htm
Outdated
| Fixed a bug in the SPECTUB matrix (introduced in 4.0) that inverted the SPECT reconstruction along the axis. | ||
| This had resulted with an inconsitent attenuation correction orientation compared to the reonctructed image. | ||
| The axis inversion is now reverted, so if your scripts were using an inverted attenuation map they need to be | ||
| updated with this release. | ||
| See <a href="https://github.com/UCL/STIR/pull/1631"">PR #1631</a>" . </li> |
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.
This is a bit confusing (and has a few typos). Are we now inverting the x-axis in the reconstructed emission image? I hope not. If not, does the following describe it better?
| Fixed a bug in the SPECTUB matrix (introduced in 4.0) that inverted the SPECT reconstruction along the axis. | |
| This had resulted with an inconsitent attenuation correction orientation compared to the reonctructed image. | |
| The axis inversion is now reverted, so if your scripts were using an inverted attenuation map they need to be | |
| updated with this release. | |
| See <a href="https://github.com/UCL/STIR/pull/1631"">PR #1631</a>" . </li> | |
| Fixed a bug in the SPECTUB matrix (introduced in 4.0) that effectively inverted the "x" (horizontal) axis for the | |
| attenuation image. This resulted in an inconsistent attenuation image orientation compared to the reconstructed emission image. | |
| This axis inversion is now reverted, so if your scripts are using an attenuation map, you need to ***remove** | |
| calls to `invert_axis x` (or code to that effect) to get correct results.<br> | |
| See <a href="https://github.com/UCL/STIR/pull/1631"">PR #1631</a>". | |
| </li> |
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.
yes sorry
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.
hmmm. I think we are indeed x-flipping the emission image. Worse than I thought.
Co-authored-by: Kris Thielemans <[email protected]>
|
We need to be 100% clear in our release notes, and I have doubts that my suggested edit is ok. Also, you will need to run |
|
sorry. forward projection now fails in |
|
Dear Professor @KrisThielemans, Therefore, could you please change only line 113 of |
|
@Dimitra-Kyriakopoulou we renamed the file in the script (dropping "_modified"), but we forgot to update the .par file. Should be fine now. @danieldeidda I also did some more clean-up, and adjusted the release notes again according to my latest understanding. Please check! This is a rather drastic change however. It's going to make lots of people unhappy... |
|
Dear Professor @KrisThielemans, In hindsight, after the attenuation-related change did not resolve the issue, it became clear this wasn’t a numerical issue but a baseline mismatch: the After refreshing the baselines to the current, unflipped geometry, the tests passed. The attached updated script can run in two ways: A) Refresh mode (run with It intentionally updates the references to the new convention, ie. after removing the previous x-flip:
-- Next normal run will compare against the new B) Normal mode (run with no flag) Run TWICE: . If the THANK YOU SO MUCH FOR READING THIS MESSAGE! |
|
Thanks @Dimitra-Kyriakopoulou I've resolved this in another way. (I won't to avoid modifying the We just have a problem due to #1639 which will be resolved when merging with |
|
Dear Professor @KrisThielemans, For the clean up, it may also be safe to remove the generate_atten_cylinder_SPECT.par in recon_test_pack folder. THANK YOU WHOLEHEARTEDLY FOR YOUR COMMENT!!! |
|
@KrisThielemans i think the notes are OK. @Dimitra-Kyriakopoulou thanks I removed the parfile too. |
|
@danieldeidda the effect of this change is rather dramatic. It is going to break @samdporter and @varzakis work for the STIR User's meeting. I think we should postpone it for after the release (i.e. until after MIC). @Dimitra-Kyriakopoulou I then plan to add a note that SRT2DSPECT gives the correct orientation. |
|
AppVeyor builds fails due to #1642. Please ignore. |
|
OK for me. Is there anything to do before then on this? |
|
we'll have to merge sorry |
Changes in this pull request
Testing performed
Related issues
Checklist before requesting a review
documentation/release_XXX.mdhas been updated with any functionality change (if applicable)Contribution Notes
Please tick the following: