httomolibgpu.prep.stripe#

Module for stripes removal

httomolibgpu.prep.stripe.raven_filter(data: <cp.ndarray>, pad_y: int = 20, pad_x: int = 20, pad_method: str = 'edge', uvalue: int = 20, nvalue: int = 4, vvalue: int = 2) <cp.ndarray>[source]#

Applies FFT-based Raven filter [5] to a 3D CuPy array. For more detailed information, see Raven filter.

Parameters
  • data (cp.ndarray) – Input CuPy 3D array either float32 or uint16 data type.

  • pad_y (int, optional) – Pad the top and bottom of projections.

  • pad_x (int, optional) – Pad the left and right of projections.

  • pad_method (str, optional) – Numpy pad method to use.

  • uvalue (int, optional) – The shape of filter.

  • nvalue (int, optional) – The shape of filter.

  • vvalue (int, optional) – The number of rows to be applied the filter

Returns

Raven filtered 3D CuPy array in float32 data type.

Return type

cp.ndarray

Raises

ValueError – If the input array is not three dimensional.

httomolibgpu.prep.stripe.remove_all_stripe(data: <cp.ndarray>, snr: float = 3.0, la_size: int = 61, sm_size: int = 21, dim: int = 1) <cp.ndarray>[source]#

Remove all types of stripe artifacts from sinogram using Nghia Vo’s approach, see [9] (combination of algorithm 3,4,5, and 6).

Parameters
  • data (ndarray) – 3D tomographic data as a CuPy array.

  • snr (float, optional) – Ratio used to locate large stripes. Greater is less sensitive.

  • la_size (int, optional) – Window size of the median filter to remove large stripes.

  • sm_size (int, optional) – Window size of the median filter to remove small-to-medium stripes.

  • dim ({1, 2}, optional) – Dimension of the window.

Returns

Corrected 3D tomographic data as a CuPy or NumPy array.

Return type

ndarray

httomolibgpu.prep.stripe.remove_stripe_based_sorting(data: typing.Union[<cp.ndarray>, <cp.ndarray>], size: int = 11, dim: int = 1) Union[<cp.ndarray>, <cp.ndarray>][source]#

Remove full and partial stripe artifacts from sinogram using Nghia Vo’s approach, see [9]. This algorithm works particularly well for removing partial stripes.

Steps of the algorithm: 1. Sort each column of the sinogram by its grayscale values. 2. Apply a smoothing (median) filter on the sorted image along each row. 3. Re-sort the smoothed image columns to the original rows to get the corrected sinogram.

Parameters
  • data (ndarray) – 3D tomographic data as a CuPy or NumPy array.

  • size (int, optional) – Window size of the median filter.

  • dim ({1, 2}, optional) – Dimension of the window.

Returns

Corrected 3D tomographic data as a CuPy or NumPy array.

Return type

ndarray

httomolibgpu.prep.stripe.remove_stripe_ti(data: typing.Union[<cp.ndarray>, <cp.ndarray>], beta: float = 0.1) Union[<cp.ndarray>, <cp.ndarray>][source]#

Removes stripes with the method of V. Titarenko (TomoCuPy implementation). See [6].

Parameters
  • data (ndarray) – 3D stack of projections as a CuPy array.

  • beta (float, optional) – filter parameter, lower values increase the filter strength. Default is 0.1.

Returns

3D array of de-striped projections.

Return type

ndarray