-
Couldn't load subscription status.
- Fork 99
GATE/ROOT STIR LOR consistency test #991
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
Conversation
09191f9 to
797affe
Compare
| generate_image generate_image${I}.par | ||
| cd Gate_macros | ||
| # Create main GATE macro files from template | ||
| sed -e s/SOURCENAME/test${I}/ main_D690_template.mac > main_D690_test${I}.mac |
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.
sed issues may occur on MacOS. I personally have to use gsed for this command to work. This is documented elsewhere but may lead to issues for us in this case.
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.
it's true, but the pretest script is only run to create the files, so presumably only needs running once in a while. Let's live with it (maybe just add a TODO comment in the file)
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.
Agreed. The hroot and root files can be downloaded. run_pretest_script.sh does not need to be run for each test.
|
Current status. All tests pass with the Gate generated data and take about 1.5 seconds each. The tests are stacked as follows. |
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.
looks good. I'm a bit confused on the relation between test_view_offset_root.cxx and test_consistency_root.cxx.
Also, a question is where we put the GATE macros. etc. It feels strange to me to have them in recon_test_pack, as that is currently standalone (scripts and data, used on "installed STIR"). I note that files for recon_test_pack/run_root_GATE.sh sit in examples/GATE_test_macro (even that's incomplete). That is of course a bit confusing as well. Depends a bit how independent the test is from these files. (We could have them in examples but include them in the Zenodo upload for instance)
oh, you want to merge this first, and then sort out the TOF stuff later. agreed. |
Splitting The main weakness here is the independence of the point source locations in the GATE macros and .par files. I'd prefer to run GATE from the STIR images, but maybe that's a job for the STIR-GATE-Connection/ so too complicated for here. As you prefer. |
|
No, I haven't looked at generate_image before. |
a843b44 to
3531891
Compare
|
Two step process:
New test pass with this modification, as does |
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.
some comments on generate_image. Add a line about it in release_5.0.htm (in the developer's section I guess). Can then also add a line about the test there somewhere
I think this is part of the final steps now. Where do these macro files belong? Secondly, how do we run the test if the data is not present? |
I wouldn't mind putting them in
I suggest that the download is part of the test. Two options:
The 2nd option seems far simpler, even though it relies on CMake being present at test-time (which could be a minor problem with the conda recipe, but we can fix that). |
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.
Suggested fixes to simplify, speed up, and reduce data size for the test. Some future (TOF) proofing too.
recon_test_pack/ROOT_STIR_consistency/Gate_macros/digitiser_D690.mac
Outdated
Show resolved
Hide resolved
recon_test_pack/ROOT_STIR_consistency/Gate_macros/digitiser_D690.mac
Outdated
Show resolved
Hide resolved
| @@ -0,0 +1,117 @@ | |||
| # CYLINDRICAL | |||
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 D690 geometry does not match that in the SGC.
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.
Could add a scanner without blocks/buckets and only crystals. Probably not worth it as it wouldnt tests any of the other functionality.
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.
Gate geometry has been updated to better reflect the blocks and buckets. We could continue to modify this.
recon_test_pack/ROOT_STIR_consistency/Gate_macros/digitiser_D690.mac
Outdated
Show resolved
Hide resolved
recon_test_pack/ROOT_STIR_consistency/Gate_macros/geometry_D690.mac
Outdated
Show resolved
Hide resolved
recon_test_pack/ROOT_STIR_consistency/Gate_macros/geometry_D690.mac
Outdated
Show resolved
Hide resolved
For more information, please check the 2017 MIC presentation I have done during the STIR user's meeting.
… with GenerateImage rather than load from file. Also fix some messaging regarding main
…test_view_offset_root` script
|
With the latest changes to the GATE geometry and crystal material, the ROOT files are ~400kB (each so ~5MB total) with 2000-2400 coincidence events in each. These tests are all passing on my machine. Is this still too large to include on GitHub and do we still need Zenodo? Probably, and then more can be added later. As alluded to in #938 (comment), this GATE scanner is still 90 degrees rotated so before an upload of the root files we may want to address that issue. Also, not too happy with the verbosity of the test, as seen in the previous comment: #991 (comment). Edit: fixed in 5375973 and 8114f3c |
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.
tiny clean-up comments
examples/ROOT_files/ROOT_STIR_consistency/run_pretest_script.sh
Outdated
Show resolved
Hide resolved
On the one hand, Zenodo/github often creates time-outs, but on the other, test data size can only grow as you say. I therefore still think we should do that. I do think we have to remove the Do you have some plots to show? |
Okay
Agreed. This PR or a seperate with local testing for now?
No plots needed I think. The output of the python script is below. Changing the GATE scanner geometry, crystal size, and crystal material appears to have alligned the tests fairly well and simplified a lot. This is with the Blocky GATE D690 scanner and STIR cylindrical PET geometry. Less than 5% error for each point source. A failed event occurs when the closest voxel in the LOR to the original coordinates is greater than No real offset in any axis. The |
|
we could merge it now, but then the test will have to be disabled in |
|
Less than 5% is great, but if some of these are 10cm off, it's still weird. I guess a histogram plot would reassure me (truncated in vertical axis as it'll be dominated by the peak). |
| print(f"{key} || {num_events} " | ||
| f"|| {num_failed_events} " | ||
| f"|| {round_sig(percentage, 3)} {warning_msg}") |
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.
if you happen to know how to put consistent width in printing in Python, would be good to add it here
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.
I had way too much fun doing this with copilot so the new changes are exessive but it looks pretty 😄
Information regarding pass fail rate of the view offset test
SourceID | Number of Events | Failed Events | Failure (%)
---------------------------------------------------------------------------
1 | 2404 | 72 | 3.0
2 | 2407 | 72 | 2.99
3 | 2409 | 76 | 3.15
4 | 2384 | 73 | 3.06
5 | 2074 | 9 | 0.434
6 | 2089 | 8 | 0.383
7 | 2408 | 62 | 2.57
8 | 2309 | 60 | 2.6
9 | 2406 | 81 | 3.37
10 | 2451 | 74 | 3.02
11 | 2011 | 9 | 0.448
Mean offset in each axis for each source position
SourceID | Mean Offset (x) | Mean Offset (y) | Mean Offset (z)
-----------------------------------------------------------------------
1 | -2.05 | 0.61 | 0.357
2 | 1.97 | -0.519 | 0.264
3 | -0.542 | -2.03 | 0.33
4 | 0.536 | 2.01 | 0.304
5 | -0.724 | -0.299 | 0.425
6 | -0.242 | 0.814 | 0.453
7 | -1.97 | 0.542 | -0.412
8 | 1.99 | -0.606 | -0.449
9 | -0.641 | -2.06 | -0.432
10 | 0.584 | 2.02 | -0.419
11 | -0.659 | -0.358 | -0.647
TOTAL BIAS IN EACH AXIS
Total Bias (x) | Total Bias (y) | Total Bias (z)
--------------------------------------------------
-0.159 | 0.0114 | -0.0206
Done
examples/ROOT_files/ROOT_STIR_consistency/DebugScripts/debug_view_offset_consistency.py
Outdated
Show resolved
Hide resolved
I have disabled the test. Lets merge it now (if ready) and this test can be used on seperate branch to try to fix #938 |
Adds a consistency test between GATE and STIR data that was initially described in #938 (comment). This is based upon work conducted previously by @eliseemond for a TOF test.
Simulate emission of (12) point sources in GATE with known
originalposition. Read the output ROOT files using STIR finding the closest voxel to theoriginalposition and measure distance. If distance is greater than a given tolerance then mark event asfailed_event. Ensure that the majority of events are within the tolerance.toleranceis currently set to `1.5 * norm(grid_spacing).A possible alternative, test the
mean(abs(distance)) < tolerance?This PR has a lot of overlap with a similar TOF test in development NikEfth#23. I suggest this PR is merged into UCL/STIR and then UCL/STIR into the TOF branch and deal with conflicts there.
REMANING TODO
distanceresults. Some values are up to10* tolerancegenerate_image.cxxand create a class methods to generate and save the image. The utilility can call both but this test can simply generate and keep in memory... thoughts?source_test${i}.macmatches the voxel position ingenerate_image${i}.par