Skip to content

PETSIRD 0.13 - #1786

Draft
KrisThielemans wants to merge 12 commits into
UCL:masterfrom
KrisThielemans:PETSIRD_0.13
Draft

KrisThielemans wants to merge 12 commits into
UCL:masterfrom
KrisThielemans:PETSIRD_0.13

Conversation

@KrisThielemans

Copy link
Copy Markdown
Collaborator

Adapt to cope with changes in PETSIRD geometry (mostly that the translation of modules to the radial position is now implemented in the module transforms).

@KrisThielemans KrisThielemans self-assigned this Nov 9, 2026
@codacy-production

codacy-production Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

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.

@KrisThielemans

Copy link
Copy Markdown
Collaborator Author

Currently fails for a few things. On the petsird_generator output, which uses

constexpr float RADIUS = 400.F;
constexpr std::array<float, 3> CRYSTAL_LENGTH{ 20.F, 4.F, 4.F };
constexpr std::array<float, 3> NUM_CRYSTALS_PER_MODULE{ 2, 4, 7 };
constexpr float AVERAGE_DOI{ 9.F };
constexpr unsigned MATERIAL_ID{ 1U };
constexpr uint32_t NUM_MODULES_ALONG_RING{ 20 };
constexpr uint32_t NUM_MODULES_ALONG_AXIS{ 2 };
constexpr float MODULE_AXIS_SPACING{ (NUM_CRYSTALS_PER_MODULE[2] + 4) * CRYSTAL_LENGTH[2] };

I get

  Number of rings                          := 14
  Number of detectors per ring             := 8 <-- WRONG, should be 20*4
  Inner ring diameter (cm)                 := 81.8 <-- WRONG, doesn't take DOI into account yet
  Average depth of interaction (cm)        := 0 <-- WRONG
  Distance between rings (cm)              := 0.4
  Default bin size (cm)                    := 0.4
  View offset (degrees)                    := 0 <-- WRONG
  Maximum number of non-arc-corrected bins := 7<-- WRONG
  Default number of arc-corrected bins     := 7<-- WRONG
  Energy resolution         := 0.11
  Reference energy (in keV) := 511
  Number of blocks per bucket in transaxial direction         := 1
  Number of blocks per bucket in axial direction              := 2
  Number of crystals per block in axial direction             := 7
  Number of crystals per block in transaxial direction        := 4
  Number of detector layers                                   := 1
  Number of crystals per singles unit in axial direction      := 7 <-- NOT YET DETERMINED
  Number of crystals per singles unit in transaxial direction := 4 <-- NOT YET DETERMINED
  Scanner geometry (BlocksOnCylindrical/Cylindrical/Generic)  := BlocksOnCylindrical
  Distance between crystals in axial direction (cm)           := 0.4
  Distance between crystals in transaxial direction (cm)      := 0.4
  Distance between blocks in axial direction (cm)             := 2.8 <-- WRONG (should be 1.1*4)
  Distance between blocks in transaxial direction (cm)        := 1.6

@KrisThielemans
KrisThielemans force-pushed the PETSIRD_0.13 branch 2 times, most recently from 3d4c8fa to 9024dd4 Compare November 10, 2026 08:56
The radius is now implemented via translation of the modules
(not the translation of the elements within the module).
@KrisThielemans

Copy link
Copy Markdown
Collaborator Author

Closer, but not ready. I currently get the following for module coordinates along the axis

INFO: Centre at (3.0517579e-06,-1.6784668e-05,22)
ANGLES: {0, 0, 0.314, 0.314, 0.628, 0.628, 0.942, 0.942, 1.257, 1.257, 1.571, 1.571, 1.885, 1.885, 2.199, 2.199, 2.513, 2.513, 2.827, 2.827, 3.142, 3.142, 3.456, 3.456, 3.77, 3.77, 4.084, 4.084, 4.398, 4.398, 4.712, 4.712, 5.027, 5.027, 5.341, 5.341, 5.655, 5.655, 5.969, 5.969}
Axial poss: {-22, 22, -22, 22, -22, 22, -22, 22, -22, 22, -22, 22, -22, 22, -22, 22, -22, 22, -22, 22, -22, 22, -22, 22, -22, 22, -22, 22, -22, 22, -22, 22, -22, 22, -22, 22, -22, 22, -22, 22}

which is all fine and

  Number of rings                          := 14
  Number of detectors per ring             := 80
  Inner ring diameter (cm)                 := 81.8
  Average depth of interaction (cm)        := 0<-- NOT YET DETERMINED
  Distance between rings (cm)              := 0.4
  Default bin size (cm)                    := 0.4
  View offset (degrees)                    := 0<-- WRONG
  Maximum number of non-arc-corrected bins := 79
  Default number of arc-corrected bins     := 79
  Energy resolution         := 0.11
  Reference energy (in keV) := 511
  Number of blocks per bucket in transaxial direction         := 1
  Number of blocks per bucket in axial direction              := 2
  Number of crystals per block in axial direction             := 7
  Number of crystals per block in transaxial direction        := 4
  Number of detector layers                                   := 1
  Number of crystals per singles unit in axial direction      := 7<-- NOT YET DETERMINED
  Number of crystals per singles unit in transaxial direction := 4<-- NOT YET DETERMINED
  Scanner geometry (BlocksOnCylindrical/Cylindrical/Generic)  := BlocksOnCylindrical
  Distance between crystals in axial direction (cm)           := 0.4
  Distance between crystals in transaxial direction (cm)      := 0.4
  Distance between blocks in axial direction (cm)             := 2.8 <-- WRONG
  Distance between blocks in transaxial direction (cm)        := 1.6; <-- probably WRONG

@KrisThielemans KrisThielemans added this to the v6.6 milestone Nov 11, 2026
@NikEfth

NikEfth commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

which file do you use for testing?

@KrisThielemans

Copy link
Copy Markdown
Collaborator Author

output of petsird_generator for now. Obviously, the events are nonsensical, but geometry should be fine

@NikEfth

NikEfth commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

Finally got the petsird_generator to work.

@KrisThielemans

Copy link
Copy Markdown
Collaborator Author

@NikEfth wrote

Should we also handle the tilt?
If I am correct we should tilt such that the PETSIRD first crystal should be at the y axis of STIR

Not sure which tilt you're talking about.

  • STIR of course has azimuthal offset to cope with rotations around the ring. I'd use that as opposed to rotating all coordinates. Would then be something like Scanner:: set_intrinsic_azimuthal_tilt(angle_wrt_y_of_first_crystal_of_first_module)
  • Of course, one could have tilt of the axis itself. That's a whole different ballgame, which I suggest we leave for later.

@NikEfth

NikEfth commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

I was referering to the View offset. I am sorry for the confusion.

@KrisThielemans

Copy link
Copy Markdown
Collaborator Author

job failures because conda's picking up libpetsird 0.12.2

@KrisThielemans

Copy link
Copy Markdown
Collaborator Author

job failures because conda's picking up libpetsird 0.12.2

fixed. @NikEfth please pull this. (don't work from your prevoius branch due to the squash-merge and this commit)

We were using "module" for DOI (and "module_pair" in efficiencies)
where it should have been "type_of_module".
However, both were zero, so the result is the same.
@KrisThielemans

Copy link
Copy Markdown
Collaborator Author

CI failures due to #1794. I'll need to merge master on here.

@codacy-production

codacy-production Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 15 complexity · 4 duplication

Metric Results
Complexity 15
Duplication 4

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.

@KrisThielemans

Copy link
Copy Markdown
Collaborator Author

I've fixed the block axial spacing, but not in the general case, but the "non-tiled" one (which the "generated" scanner still falls back to). I don't think the detection of the tiling is correct, but it doesn't matter for this scanner.

I've put in some checks for non-uniform sampling and currently bail out.

Current scanner output seems correct for this test case, but the debug print of ADP vs STIR coordinates shows large differences (hopefully a intrinsic_tilt offset, but not sure). There is a known z-translation as well due to choice of origin that I haven't fixed yet in the debug print).

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.

2 participants