Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bindings to ASTRA cylindrical detector geometries #1634

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add FIXME note
  • Loading branch information
wjp committed Feb 1, 2024
commit 5fb20c1b3cc2ef3ceb768becdf53a26ed3181fd6
3 changes: 3 additions & 0 deletions odl/tomo/backends/astra_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,9 @@ def astra_cyl_conebeam_3d_geom_to_vec(geometry):
vectors[:, 0:3] = geometry.src_position(angles)

# Center of detector in 3D space
# FIXME: This is not correct: det_point_position returns the zero-point of
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, det_point_position return the center of the detector, so this is correct. The problem is with geometry.det_axes(angles), because axes are "attached" to the zero-point and not to the center as ASTRA assumes.

Copy link
Contributor

@JevgenijaAksjonova JevgenijaAksjonova Feb 13, 2024

Choose a reason for hiding this comment

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

I think the next few lines should look as follows:

    # Center of detector in 3D space
    mid_pt = geometry.det_params.mid_pt
    vectors[:, 3:6] = geometry.det_point_position(angles, mid_pt)
    # reverse the sign, since the partition angle in CylindricalDetector 
    # increases in the clockwise direction, by analogy to flat detectors
    det_shift_angle = -mid_pt[0]

    # `det_axes` gives shape (N, 2, 3), swap to get (2, N, 3)
    det_axes = np.moveaxis(geometry.det_axes(angles + det_shift_angle), -2, 0)

The detector partition along the first dimension is given in radians, so the distance from the mid_pt[0] to the 0 point is an angle. It is sufficient to add this angle to source angles to rotate the detector axes, however the sign should be reversed, because angles increase clockwise on the detector (to be consistent with the default setup for flat detector)

This solution does not affect the situation, when the detector is positioned symmetrically. So, one could still implement the detector shift by using detector_shift_func and rotating the axes.

# the detector, and not the center of the detector. For quarter-pixel-shifted
# detector these two do not coincide.
mid_pt = geometry.det_params.mid_pt
vectors[:, 3:6] = geometry.det_point_position(angles, mid_pt)

Expand Down