Hi,
I think there is an error in the GetRdmPositionsAndOrientations function of the file iScannerPET.cc. In short, the vectors used to create a random position in a detector are not orthogonal between each other and two of them are not guaranteed to have a norm of one.
The long version:
mp_crystalOrientation gives us a vector that goes along the depth of the current detector. However, CASToR does not keep a similar vector for the detector's transaxial and axial axes. For simplicity, let's define (mp_crystalOrientationX, mp_crystalOrientationY, mp_crystalOrientationZ) as (uX, uY, uZ). Currently, the transaxial axis of the detector is defined as (in the function GetRdmPositionsAndOrientations):
(uY, uX, 0)
while the axial axis of the detector is defined as:
(uX*uZ, uY*uZ, sqrt(1-uZ**2))
From there, we can observe several problems. Two examples:
1) (uX, uY, uZ) (uY, uX, 0)' = uX*uY + uY*uX =/= 0 (Most of the time.)
2) || (uY, uX, 0) || =/= 1 if uZ =/= 0 (Since ||(uX, uY, uZ)|| = 1.)
Thus, the set of positions generated by that function does not correspond exactly to the detector.
A possible correction: (it needs to be applied on the computation of ap_Position1 and ap_Position2)
Replace (uY, uX, 0) by (uY, -uX, 0) / || (uY, -uX, 0) ||
Replace (uX*uZ, uY*uZ, sqrt(1-uZ**2)) by (-uX*uZ, -uY*uZ, 1-uZ**2) / || (-uX*uZ, -uY*uZ, 1-uZ**2) ||
Note: Since mp_crystalOrientationZ is 0.0 for all detectors in most scanner, this error might have negligible repercussions in practice. I am not sure, since I didn't test its repercussions in reconstruction.
I have another question. In the comments prior to the function GetRdmPositionsAndOrientations, there is the following line: "fix the possibility to draw LOR outside the actual crystal volume (if mp_meanDepthOfInteraction != 0.5)". From what I understand, that function never uses that parameter. Was that comment meant for the function GetPositionsAndOrientations or did I miss something?
Have a nice day,
Maxime Toussaint