scico.linop.abel#

Abel transform LinearOperator wrapping the pyabel package.

Abel transform LinearOperator wrapping the pyabel package.

Classes

AbelTransform(img_shape)

Abel transform based on PyAbel.

class scico.linop.abel.AbelTransform(img_shape)[source]#

Bases: LinearOperator

Abel transform based on PyAbel.

Inheritance diagram of AbelTransform

Perform Abel transform (parallel beam projection of cylindrically symmetric objects) for a 2D image. The input 2D image is assumed to be centered and left-right symmetric.

Parameters:

img_shape (Tuple[int, ...]) – Shape of the input image.

inverse(y)[source]#

Perform inverse Abel transform.

Parameters:

y (Array) – Input image (assumed to be a result of an Abel transform).

Return type:

Array

Returns:

Output of inverse Abel transform.

scico.linop.abel.get_image_quadrants(IM, reorient=True, symmetry_axis=None, use_quadrants=(True, True, True, True), symmetrize_method='average')#

Given an image (m, n) return its 4 quadrants Q0, Q1, Q2, Q3 as defined below.

Parameters:
  • IM (2D np.array) – Image data shape (rows, cols)

  • reorient (boolean) – Reorient quadrants to match the orientation of Q0 (top-right)

  • symmetry_axis (int or tuple) – can have values of None, 0, 1, or (0, 1) and specifies no symmetry, vertical symmetry axis, horizontal symmetry axis, and both vertical and horizontal symmetry axes. Quadrants are added. See Note.

  • use_quadrants (boolean tuple) – Include quadrant (Q0, Q1, Q2, Q3) in the symmetry combination(s) and final image

  • symmetrize_method (str) –

    Method used for symmetrizing the image.

    average

    Simply average the quadrants.

    fourier

    Axial symmetry implies that the Fourier components of the 2-D projection should be real. Removing the imaginary components in reciprocal space leaves a symmetric projection.

    K. R. Overstreet, P. Zabawa, J. Tallant, A. Schwettmann, J. P. Shaffer, “Multiple scattering and the density distribution of a Cs MOT”, Optics Express 13, 9672–9682 (2005).

Returns:

Q0, Q1, Q2, Q3 (tuple of 2D np.arrays) – shape: (rows // 2 + rows % 2, cols // 2 + cols % 2) all oriented in the same direction as Q0 if reorient=True

Notes

The symmetry_axis keyword averages quadrants like this:

+--------+--------+
| Q1   * | *   Q0 |
|   *    |    *   |
|  *     |     *  |                 cQ1 | cQ0
+--------o--------+  --(output)-->  ----o----
|  *     |     *  |                 cQ2 | cQ3
|   *    |    *   |
| Q2  *  | *   Q3 |          cQi == combined quadrants
+--------+--------+

symmetry_axis = None           — individual quadrants
symmetry_axis = 0 (vertical)   — average Q0 + Q1, and Q2 + Q3
symmetry_axis = 1 (horizontal) — average Q1 + Q2, and Q0 + Q3
symmetry_axis = (0, 1) (both)  — combine and average all 4 quadrants

The end results look like this:

(0) symmetry_axis = None

    returned image   Q1 | Q0
                     ---o---
                     Q2 | Q3

(1) symmetry_axis = 0

    Combine:  Q01 = Q0 + Q1, Q23 = Q2 + Q3
    returned image   Q01 | Q01
                     ----o----
                     Q23 | Q23

(2) symmetry_axis = 1

    Combine: Q12 = Q1 + Q2, Q03 = Q0 + Q3
    returned image   Q12 | Q03
                     ----o----
                     Q12 | Q03

(3) symmetry_axis = (0, 1)

    Combine all quadrants: Q = Q0 + Q1 + Q2 + Q3
    returned image   Q | Q
                     --o--   all quadrants equivalent
                     Q | Q
scico.linop.abel.put_image_quadrants(Q, original_image_shape, symmetry_axis=None)#

Reassemble image from 4 quadrants Q = (Q0, Q1, Q2, Q3) The reverse process to get_image_quadrants with reorient=True.

Note: the quadrants should all be oriented as Q0, the upper right quadrant

Parameters:
  • Q (tuple of np.array (Q0, Q1, Q2, Q3)) –

    Image quadrants all oriented as Q0 shape (rows // 2 + rows % 2, cols // 2 + cols % 2)

    +--------+--------+
    | Q1   * | *   Q0 |
    |   *    |    *   |
    |  *     |     *  |
    +--------o--------+
    |  *     |     *  |
    |   *    |    *   |
    | Q2  *  | *   Q3 |
    +--------+--------+
    

  • original_image_shape (tuple) –

    (rows, cols)

    reverses the padding added by get_image_quadrants for odd axis sizes

    odd row trims 1 row from Q1, Q0

    odd column trims 1 column from Q1, Q2

  • symmetry_axis (int or tuple) –

    impose image symmetry

    symmetry_axis = 0 (vertical)   Q0 == Q1 and Q3 == Q2 symmetry_axis = 1 (horizontal) Q2 == Q1 and Q3 == Q0

Returns:

IM (np.array) –

Reassembled image of shape (rows, cols):

symmetry_axis =

    None:      0:          1:         (0, 1):

    Q1 | Q0    Q1 | Q1     Q1 | Q0    Q1 | Q1
    ---o---    ---o----    ---o---    ---o---
    Q2 | Q3    Q2 | Q2     Q1 | Q0    Q1 | Q1