Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Better generic/blocks-on-cylindrical support: ROOT support and enabled TOF - #1746

Open
KrisThielemans wants to merge 17 commits into
UCL:masterfrom
KrisThielemans:ROOTBlocksSupport
Open

Better generic/blocks-on-cylindrical support: ROOT support and enabled TOF#1746
KrisThielemans wants to merge 17 commits into
UCL:masterfrom
KrisThielemans:ROOTBlocksSupport

Conversation

@KrisThielemans

Copy link
Copy Markdown
Collaborator

Add support for blocks on cylindrical scanners for reading GATE ROOT list-mode files.

Currently no tests for it yet. Help appreciated. @NikEfth @VietAnhDao

try to future-proof changes in the hierarchy
add "blocks" keywords to .hroot
@codacy-production

codacy-production Bot commented Aug 10, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 4 complexity · 14 duplication

Metric Results
Complexity 4
Duplication 14

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.

@NikEfth NikEfth self-assigned this Aug 10, 2026
- add RunTests::check_if_equal for LORInAxialAndNoArcCorrSinogramCoordinates
(and DetectoinPositionPair)
- add text output to stream for LORInAxialAndNoArcCorrSinogramCoordinates
- use the latter in Python
- add basic checks on crystal/blocks spacing when constructing the
  geometry (call error() when they fail).
- add check on ring-distance (call warning() when it fails)
  See UCL#1753
- add block-info for GE Signa PET/MR

The checks will be performed when calling Scanner::set_up().

WARNING: set_up() now needs to be called explicitly.
(We used to call it in the constructor, but can no longer do that
as it might then throw in unexpected cases).
no longer set tof_mashing=0 and remove some checks
that were throwing errors if TOF data was detected.

adapt test_time_of_flight.cxx to test the Blocks case.
This needed coping with LOR end-points not necessarily corresponding
to the detectors.
If the scanner was recognised, but the
axial_distance_between_crystals_in_cm was not explicitly
given, it was initialised from the transaxial distance.

Fixes UCL#1752
@KrisThielemans

KrisThielemans commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator Author

All ctests work on my machine. However, the headers of the test files on Zenodo need updating, so CI will currently still fail.

We could fix the headers during CI, but I suppose it's better to upload a new version on Zenodo anyway.

IMPORTANT: to get all the tests to work, I had to enable TOF for blocks-on-cylindrical (and fix a few bugs elsewhere).

@NikEfth

NikEfth commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

I can work on this after Thursday

@KrisThielemans

Copy link
Copy Markdown
Collaborator Author

CI failures:

  • zenodo download failed (but CI would have failed anyway)
  • test_OSMAPOSL_parallelproj fails. I've seen that on my machine as well, although I don't understand why. (It seems to be reconstructing arc-corrected data).

else
set_scanner_geometry(scanner_geometry_v);

set_up();

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Probably best to re-instate this, but I had some trouble during testing.

@KrisThielemans

KrisThielemans commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator Author
  • test_OSMAPOSL_parallelproj fails. I've seen that on my machine as well, although I don't understand why. (It seems to be reconstructing arc-corrected data).

reconstructed image with parallelproj seems to use very different dimensions. Still no idea why.
image

@KrisThielemans

Copy link
Copy Markdown
Collaborator Author

I had to call Scanner:set_up() in more cases. Tests should work now (aside from the Zenodo problem)

valgrind detected that ProjectorByBinPairUsingParallelproj::_already_set_up
was used before initialisatoin in set_defaults(). It shouldn't matter
as it was afterwards set to false anyway. Nevertheless, best to fix it.
@KrisThielemans

Copy link
Copy Markdown
Collaborator Author

test_OSMAPOSL_parallelproj still fails on GHA, but in a different way (reconstructed images are apparently zero), and not on my laptop. grrr

KrisThielemans and others added 2 commits September 12, 2026 09:10
Also run on non-arccorrected data, as that's what we do
these days.
* Ask scanner if has been set_up before constructing ProjDataInfo

* Make sure set_up() is called in every test.
@KrisThielemans

Copy link
Copy Markdown
Collaborator Author

I was a bit surprised that test_consistency_with_GATE is working fine with the old (i.e. cylindrical) .hroot files, but of course it should, as otherwise we would have broken something.

I still think it's better to test with "blocks" .hroot. (I suppose we could test with both, but I'm not sure that's really a good idea).

@KrisThielemans

Copy link
Copy Markdown
Collaborator Author

Appveyor build for VS 2019 fails while compiling test_IO_ITKMulticomponent.cxx with

https://ci.appveyor.com/project/KrisThielemans/stir/builds/54710682/job/jucuo2u66rcx3u2d#L2838

C:\projects\stir\src\include\stir/LORCoordinates.inl(297): warning C4244: '=': conversion from 'double' to 'coordT', possible loss of data
        with
        [
            coordT=size_t
        ]
C:\projects\stir\src\include\stir/modulo.h(140): error C2668: 'stir::modulo': ambiguous call to overloaded function
C:\projects\stir\src\include\stir/modulo.h(87): note: could be 'int stir::modulo(const int,const int)'
C:\projects\stir\src\include\stir/modulo.h(70): note: or       'float stir::modulo(const float,const float)'
C:\projects\stir\src\include\stir/modulo.h(52): note: or       'double stir::modulo(const double,const double)'
C:\projects\stir\src\include\stir/modulo.h(140): note: while trying to match the argument list '(const FloatOrDouble, FloatOrDouble)'
        with
        [
            FloatOrDouble=size_t
        ]
C:\projects\stir\src\include\stir/LORCoordinates.inl(134): note: see reference to function template instantiation 'FloatOrDouble stir::to_0_2pi<coordT>(const FloatOrDouble)' being compiled
        with
        [
            FloatOrDouble=size_t,
            coordT=size_t
        ]
C:\projects\stir\src\include\stir/LORCoordinates.inl(130): note: while compiling class template member function 'stir::LORInCylinderCoordinates<coordT>::LORInCylinderCoordinates(const stir::LORInAxialAndNoArcCorrSinogramCoordinates<coordT> &)'
        with
        [
            coordT=size_t
        ]
C:\projects\stir\src\include\stir/LORCoordinates.inl(492): note: see reference to function template instantiation 'stir::LORInCylinderCoordinates<coordT>::LORInCylinderCoordinates(const stir::LORInAxialAndNoArcCorrSinogramCoordinates<coordT> &)' being compiled
        with
        [
            coordT=size_t
        ]
C:\projects\stir\src\include\stir/LORCoordinates.inl(367): warning C4244: 'argument': conversion from 'float' to 'coordT', possible loss of data
        with
        [
            coordT=size_t
        ]
C:\projects\stir\src\include\stir/LORCoordinates.inl(407): note: see reference to function template instantiation 'stir::Succeeded stir::find_LOR_intersections_with_cylinder<coordT,coordT>(stir::LORInCylinderCoordinates<coordT> &,const stir::LORAs2Points<coordT> &,const double)' being compiled
        with
        [
            coordT=size_t
        ]
C:\projects\stir\src\include\stir/LORCoordinates.inl(406): note: while compiling class template member function 'stir::Succeeded stir::LORAs2Points<coordT>::change_representation(stir::LORInCylinderCoordinates<coordT> &,const double) const'
        with
        [
            coordT=size_t
        ]
C:\projects\stir\src\include\stir/LORCoordinates.inl(492): note: see reference to class template instantiation 'stir::LORAs2Points<coordT>' being compiled
        with
        [
            coordT=size_t
        ]
C:\projects\stir\src\include\stir/LORCoordinates.inl(369): warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:\projects\stir\src\include\stir/LORCoordinates.inl(370): warning C4146: unary minus operator applied to unsigned type, result still unsigned

All other compilers including VS 2022 are fine.

It's trying to instantiate LORInCylinderCoordinates<size_t> which should indeed fail. (Other warnings are related to LORInAxialAndNoArcCorrSinogramCoordinates<size_t>` ).

It looks like this is caused by

check_if_equal<size_t>(voxels_coords->size(), 64);

and the RunTests addition in this PR

template <class T>
bool
RunTests::check_if_equal(const LORInAxialAndNoArcCorrSinogramCoordinates<T>& a,
                         const LORInAxialAndNoArcCorrSinogramCoordinates<T>& b,
                         const std::string& str)

Looks like a compiler bug to me.

@KrisThielemans

Copy link
Copy Markdown
Collaborator Author

Aside from problems with downloading files from Zenodo, this is all fine now.

I'll revert the change that removed the call to set_up() from set_params() to avoid backwards compatibility problems, and make sure it is only enabled in 7.0.

@VietAnhDao @emikhay this PR that should help you with GATE simulations for blocks and hence NeuroLF. As long as you edit the .hroot file.

Summary of all changes is in the release_6.5.htm. Commit is 0eedd70.

@KrisThielemans KrisThielemans changed the title ROOT blocks-on-cylindrical support Better generic/blocks-on-cylindrical support: ROOT support and enabled TOF Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In progress

2 participants