Skip to content

Root/scanner rotation changes#1016

Merged
KrisThielemans merged 17 commits intoUCL:masterfrom
robbietuk:ROOT/ScannerRotationChanges
Apr 5, 2022
Merged

Root/scanner rotation changes#1016
KrisThielemans merged 17 commits intoUCL:masterfrom
robbietuk:ROOT/ScannerRotationChanges

Conversation

@robbietuk
Copy link
Copy Markdown
Collaborator

@robbietuk robbietuk commented Mar 30, 2022

Fix for #938 and extension of #991

  • enable test_view_offset_root test
  • Removes the addition of quarter_of_detectors from deterctor position when reading of ROOT files in STIR
  • Rotate the Gate CylindricalPET scanner by -90 degrees
  • Remove interfile parameter offset (num of detectors) from all ROOT headers
  • Update users guide
  • Reduce number of test
  • Upload data to Zenodo (see https://zenodo.org/record/6410309)
  • Automate download of data in CTests

… printing

This involves changes to 
 - the coordinates to now use 2D numpy arrays
- the print tables now print the position and offset (for loop changes were needed for sizing of every entry etc...), not perfect.
- Use more arrays everywhere, instead of lists.
@robbietuk robbietuk force-pushed the ROOT/ScannerRotationChanges branch from aa6b4b7 to b5707ac Compare March 30, 2022 23:42
Copy link
Copy Markdown
Collaborator Author

@robbietuk robbietuk left a comment

Choose a reason for hiding this comment

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

The removal of offset (num of detectors) and quarter_of_detectors works in the tests now with the rotations in GATE geometry. All our GATE geometries should be updated (thinking STIR-GATE-Connection).

Comment thread src/include/stir/IO/InputStreamFromROOTFile.inl Outdated
Comment thread src/IO/InputStreamFromROOTFile.cxx
Copy link
Copy Markdown
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.

Currently using

#if STIR_ROOT_ROTATION_AS_V4

this is non-standard. Replace with using #ifdef as usual. This obviously means that it shouldn't be set by default (I guess you currently set it to 0).

I think the user's guide need some more tweaks but first want to understand Gate macro options better (see comment in the geometry.mac).

You've enabled the test, but it cannot work yet as no data?

Comment thread src/IO/InputStreamFromROOTFile.cxx
Comment thread src/include/stir/IO/InputStreamFromROOTFile.inl Outdated
Comment thread examples/ROOT_files/ROOT_STIR_consistency/Gate_macros/geometry.mac Outdated
Comment thread documentation/release_5.0.htm Outdated
@KrisThielemans KrisThielemans added this to the v5.0.1 milestone Mar 31, 2022
@KrisThielemans
Copy link
Copy Markdown
Collaborator

Forgot to write my question on the geometry.

You've used rotation of the GATE scanner

/gate/cylindricalPET/placement/setRotationAngle -90 deg

This is nice, but I do wonder if an alternative solution isn't to modify the placement
/gate/rsector/placement/setTranslation 41.76 0.0 0.0 cm

I haven't checked of course.

Also removes all mention of commented out ellopsoid parameters
@robbietuk
Copy link
Copy Markdown
Collaborator Author

robbietuk commented Mar 31, 2022

The source positions are not optimised very well. Running generate_image on each of the STIR par files and summing them results in the following volume
image
The shown tranaxial slice is at -70mm in z and correspond to generate_image${x}.par files for x in 1 to 6. Another similar transaxial slice (same layout) exists at 70mm in z for generate_image${x}.par files for x in 7 to 12. Also, they are all in the end planes of the scanner (scanner z length L is 157.16mm) so we get no segment information.

The relationship between STIR and GATE z coordinates is stir_z = (L-d)/2 + gate_z, where L is defined above and d is the distance between rings 6.54mm.

I think we change these sources to 8 = 2^3 sources rather than all 12. Two positions per axis, one being the origin, and iterating over each of the combinations, e.g., (in GATE coordinates (x y z) and in mm):

ID x y z comment
1 0 0 0 center scanner
2 190 0 0 +x
3 0 190 0 +y
4 95 95 0 +x +y
5 0 0 70 +z
6 190 0 70 +x +z
7 0 190 70 +y +z
8 95 95 70 +x +y +z

Slight changes to 7's and 8's x and y values to keep them within the circular FOV (as is currently done). This change not only reduces the data size but also makes the source positions easier to understand. This shouldnt effect TOF either.


edit: Infact we probably could get away with 2 or 4 point source test, e.g. (origin, +x +y +z) or (origin, +x, +x +y, +x +y +z), but life is too short.

EDIT2: THE POINT SOURCE LOCATION HAS SINCE BEEN CHANGED TO THE DATA IN THE TABLE

robbietuk and others added 5 commits March 31, 2022 17:09
Correct the z shift between STIR and GATE from 75.21 mm to 75.31 mm.
- Fix issue with `round_sig(x)` function when 0 is input.
- Update README with more details of DebugScripts
- Comment out `generate_image` from pretest because it is never used. The test was changed to use the `generate_image` class in C++.
@robbietuk
Copy link
Copy Markdown
Collaborator Author

robbietuk commented Apr 1, 2022

@francescaleek If you fancy taking a look that would be useful 😄

I optimised almost everything about this test now. The last thing I need to check now is if we can remove the rotation of the cylicricalPET and construct it so the first GATE module is on y axis (x=0).

@KrisThielemans KrisThielemans linked an issue Apr 2, 2022 that may be closed by this pull request
- release_5.0.htm: moved text on ROOT rotation to "backwards incompatibility"
section, with some minor tweaks
- STIR User's guide:
  - expanded the section on ROOT, including translation
  - added brief info on CMake variables
  - corrected some text on C++ version
@KrisThielemans
Copy link
Copy Markdown
Collaborator

I've updated the documentation a bit more. @robbietuk please check if you're happy with it.

This seems good to merge. The test is enabled though, which means we'd have to download the data, otherwise ctest/GitHub Actions will fail.

zenodo is one option. Adding it to git is another but it'd have to be quite small (preferably less than 2MB). I guess you could see if you tar/gzip -9/bzip it, if size reduces. Then you'd have to uncompress in CMake, see https://stackoverflow.com/a/7052049/3467846 for the opposite problem (creating one).. If you choose that option, make sure it's classified as binary via .gitattributes.

@robbietuk
Copy link
Copy Markdown
Collaborator Author

robbietuk commented Apr 4, 2022

The data is uploaded to https://zenodo.org/record/6410309 I am working on CMAKE downloads. Do we want to use something like ExternalData for the tests?

@robbietuk
Copy link
Copy Markdown
Collaborator Author

Okay, I am stuck because of my lack of Cmake knowledge. I think the tools are all here but I cant get ExternalData CTests to work... 😢

@KrisThielemans
Copy link
Copy Markdown
Collaborator

I don't know about the ExternalData stuff. sounds interesting, but I have no time to look at it.

In SIRF, we use something which is simply, but also a bit of a pain in that it downloads the data even if you don't test. Still, I think putting that into place should be quite easy. We can presumably replace it later if there's smarter stuff around.

have a look at
https://github.com/SyneRBI/SIRF/blob/843eb25760ae8e1e15bc816748d8b80d9c34f7d2/src/Synergistic/tests/CMakeLists.txt#L19

I guess we might have to unzip, but CMake can do that as well https://cmake.org/cmake/help/latest/command/file.html#archive-extract but thi sseems to require CMAke 3.18, so I guess better to download one by one if that's possible.

@robbietuk
Copy link
Copy Markdown
Collaborator Author

robbietuk commented Apr 5, 2022

In that case, I wont go into usage of the ExternalData tools.

I uploaded each file so we have to download 16 files... It doesnt look pretty but the hash keys are annoying. Good enough for a GHA test

Comment thread src/recon_test/CMakeLists.txt
@KrisThielemans
Copy link
Copy Markdown
Collaborator

we're not currently installing ROOT in GitHub Actions (nor Appveyor), so I guess this is never tested. Sadly, installing ROOT might not be so trivial as there's no APT package.

if you tell me that this works on your system, we could merge this, and try to get CI going in a separate PR.

@robbietuk
Copy link
Copy Markdown
Collaborator Author

I forgot there were no GHA tests for root, at least it works without ROOT 😄

It works nicely on my machine.

@KrisThielemans
Copy link
Copy Markdown
Collaborator

worked on mine!

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.

ROOT view/detector offset

2 participants