Fix Parallel2D system_description precision error#2316
Conversation
Signed-off-by: Laura Murgatroyd <60604372+lauramurgatroyd@users.noreply.github.com>
lauramurgatroyd
left a comment
There was a problem hiding this comment.
Hi @gfardell, I think we need to change the code.
Please can you expand on what the issue was that you encountered?
| if abs(dot_product) < 1e-8: | ||
| return SystemConfiguration.SYSTEM_SIMPLE |
There was a problem hiding this comment.
What about a case where the detector and rotation axis are offset on the y axis. Shouldn't that also be system_simple?
e.g.
AG = AcquisitionGeometry.create_Parallel2D(detector_position=[0,10], rotation_axis_position=[0,0])
self.assertTrue(AG.system_description=='simple')
currently fails (and I think we should add it as a unit test)
There was a problem hiding this comment.
I think the previous code worked as expected because it checked if all vector values were equal and if not, checked the difference vector was parallel to the ray direction
There was a problem hiding this comment.
Good catch. We don't set detector position in many parallel cases so I didn't spot it.
|
The issue is that https://github.com/gfardell/CIL/blob/a4e2b29eab32aa5fefc11dc02584d762c601729f/Wrappers/Python/cil/framework/acquisition_geometry.py#L52 is returned if the points are equal to a tolerance, that wasn't a tighter tolerance than the code route that called it. |
|
Ok, so could changing this tolerance be a possible solution? https://github.com/gfardell/CIL/blob/a4e2b29eab32aa5fefc11dc02584d762c601729f/Wrappers/Python/cil/framework/acquisition_geometry.py#L49 |
Changes
Fixed Parallel2D geometry raising exception in system_description due to near-zero vector when rotation axis and detector positions are close but not equal.
Testing you performed
Related issues/links
Checklist