detector_transforms#
- anri.geom.detector_transforms(y_center, y_size, tilt_y, z_center, z_size, tilt_z, tilt_x, distance, o11, o12, o21, o22)[source]#
Return all transformations required to convert from detector pixel to lab space.
The units of pixel size and distance need to match, but you can choose what they are. In ImageD11, they are normally microns, but we don’t need to enforce it as they cancel out in the end. Adapted from
ImageD11.transform.compute_xyz_lab()To use these transformations, seedet_to_lab()andlab_to_det()- Parameters:
y_center (
float) – Detector Y position where the laboratory x vector hits the detector (pixels)y_size (
float) – Detector pixel size in Y.tilt_y (
float) – Tilt of the detector around lab y vector (right-handed rotation) in radians. Seedetector_rotation_matrix()z_center (
float) – Detector Z position where the laboratory x vector hits the detector (pixels)z_size (
float) – Detector pixel size in Z.tilt_z (
float) – Tilt of the detector around lab z vector (right-handed rotation) in radians. Seedetector_rotation_matrix()tilt_x (
float) – Tilt of the detector around lab x vector (right-handed rotation) in radians. Seedetector_rotation_matrix()distance (
float) – The distance from the centre of rotation (i.e. rotation axis) to the (y_center, z_center) position.o11 (
float) – 11 element of orientation matrix. Seedetector_orientation_matrix()o12 (
float) – 12 element of orientation matrix. Seedetector_orientation_matrix()o21 (
float) – 21 element of orientation matrix. Seedetector_orientation_matrix()o22 (
float) – 22 element of orientation matrix. Seedetector_orientation_matrix()
- Returns:
Notes
We can convert a detector value (s, f) to a vector in the lab frame:
\(\vec{v_{\text{det}}} = \left(s, f, 0\right)\)
\(\vec{v_{\text{lab}}} = \left(x_{\text{lab}}, y_{\text{lab}}, z_{\text{lab}}\right)\)
\(\vec{v_{\text{lab}}} = \matr{D_{\text{trans}}} \cdot \left(\vec{v_{\text{det}} + \vec{v_{\text{cen shift}}}}\right) + \vec{v_{\text{dist shift}}}\)
where:
\(\vec{v_{\text{cen shift}}} = \left(-z_{\text{center}}, -y_{\text{center}}, 0\right)\)
\(\vec{v_{\text{dist shift}}} = \left(\text{distance}, 0, 0\right)\)
\(\matr{D_{\text{trans}}} = \matr{R_{\text{det}}} \cdot \matr{R_{\text{c.o.b}}} \cdot \matr{R_{\text{orien}}} \cdot \matr{S_{\text{px size}}}\)
where:
\(\matr{R_{\text{det}}}\) comes from
detector_rotation_matrix()\(\matr{R_{\text{c.o.b}}} = \begin{bmatrix} 0 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 0 & 0 \end{bmatrix}\) which is a change-of-basis matrix that maps \(\left(z_{\text{det}}, y_{\text{det}}, 0\right)\) to \(\left(0_{\text{det}}, y_{\text{det}}, z_{\text{det}}\right)\)
\(\matr{R_{\text{orien}}}\) comes from
detector_orientation_matrix()\(\matr{S_{\text{px size}}} = \begin{bmatrix} z_{\text{size}} & 0 & 0 \\ 0 & y_{\text{size}} & 0 \\ 0 & 0 & 1 \end{bmatrix}\) scales the pixel units to the (y_size, z_size) units.