In this file, the code for three-dimensional reconstruction on GPU is provided.

abel_transform_GPU

Abel transform method is reconstruct to assume phenomenon is axis-symmetry.

<aside> 💡

abel_transform_GPU(angle: np.ndarray, center: int, winy0: int, winy1: int, winx0: int, winx1: int, device, batch_size=100) -> np.ndarray:

"""
    Perform the Abel transform using PyTorch tensors with GPU parallelization and memory optimization.

    Parameters
    ----------
    angle : np.ndarray
        A 2D numpy array representing refractive angles for each pixel.
    center : int
        The index along the y-axis corresponding to the central axis of the transform.
    winy0 : int
        The starting index along the y-axis for the region used to calculate the background mean.
    winy1 : int
        The ending index along the y-axis for the region used to calculate the background mean.
    winx0 : int
        The starting index along the x-axis for the region used to calculate the background mean.
    winx1 : int
        The ending index along the x-axis for the region used to calculate the background mean.
    device : torch.device
        Device to use for computation (e.g., 'cuda' or 'cpu').
    batch_size : int
        Number of radii (`r`) to process simultaneously for memory optimization.

    Returns
    -------
    np.ndarray
        A 2D array of refractive index differences derived from the Abel transform.
    """

</aside>

Example:

from BOSlib_GPU.reconstruction import abel_transform_GPU
refractive_index=abel_transform_GPU(angle=refraction_angle,center=1800,winy0=0,winy1=200,winx0=1000,winx1=1001,device=device,batch_size=batch_size)
plt.imshow(np.block([[refractive_index[::-1]],[refractive_index]]))
plt.colorbar()
plt.show()

Output:

image.png