7.2.5. algotom.prep.removal

Module of removal methods in the preprocessing stage:

  • Many methods for removing stripe artifact in a sinogram (<-> ring artifact in a reconstructed image).

  • A zinger removal method.

  • Blob removal methods.

Functions:

remove_stripe_based_sorting(sinogram[, ...])

Remove stripe artifacts in a sinogram using the sorting technique, algorithm 3 in Ref.

remove_stripe_based_filtering(sinogram[, ...])

Remove stripe artifacts in a sinogram using the filtering technique, algorithm 2 in Ref.

remove_stripe_based_fitting(sinogram[, ...])

Remove stripe artifacts in a sinogram using the fitting technique, algorithm 1 in Ref.

remove_large_stripe(sinogram[, snr, size, ...])

Remove large stripe artifacts in a sinogram, algorithm 5 in Ref.

remove_dead_stripe(sinogram[, snr, size, ...])

Remove unresponsive or fluctuating stripe artifacts in a sinogram, algorithm 6 in Ref.

remove_all_stripe(sinogram[, snr, la_size, ...])

Remove all types of stripe artifacts in a sinogram by combining algorithm 6, 5, 4, and 3 in Ref.

remove_stripe_based_2d_filtering_sorting(...)

Remove stripes using a 2D low-pass filter and the sorting-based technique, algorithm in section 3.3.4 in Ref.

remove_stripe_based_normalization(sinogram)

Remove stripes using the method in Ref.

remove_stripe_based_regularization(sinogram)

Remove stripes using the method in Ref.

remove_stripe_based_fft(sinogram[, u, n, v, ...])

Remove stripes using the method in Ref.

remove_stripe_based_wavelet_fft(sinogram[, ...])

Remove stripes using the method in Ref.

remove_stripe_based_interpolation(sinogram)

Combination of algorithm 4, 5, and 6 in Ref.

check_zinger_size(mat, max_size)

Check if the size of a zinger is smaller than a given size.

select_zinger(mat, max_size)

Select zingers smaller than a certain size.

remove_zinger(mat, threshold[, size, check_size])

Remove zinger using the method in Ref.

generate_blob_mask(flat, size, snr)

Generate a binary mask of blobs from a flat-field image (Ref.

remove_blob_1d(sino_1d, mask_1d)

Remove blobs in one row of a sinogram, e.g.

remove_blob(mat, mask)

Remove blobs in an image.

algotom.prep.removal.remove_stripe_based_sorting(sinogram, size=21, dim=1, **options)[source]

Remove stripe artifacts in a sinogram using the sorting technique, algorithm 3 in Ref. [1]. Angular direction is along the axis 0.

Parameters
  • sinogram (array_like) – 2D array. Sinogram image.

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

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

  • options (dict, optional) – Use another smoothing filter rather than the median filter. E.g. options={“method”: “gaussian_filter”, “para1”: (1,21)}

Returns

array_like – 2D array. Stripe-removed sinogram.

References

[1] : https://doi.org/10.1364/OE.26.028396

algotom.prep.removal.remove_stripe_based_filtering(sinogram, sigma=3, size=21, dim=1, sort=True, **options)[source]

Remove stripe artifacts in a sinogram using the filtering technique, algorithm 2 in Ref. [1]. Angular direction is along the axis 0.

Parameters
  • sinogram (array_like) – 2D array. Sinogram image

  • sigma (int) – Sigma of the Gaussian window used to separate the low-pass and high-pass components of the intensity profile of each column.

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

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

  • sort (bool, optional) – Apply sorting if True.

  • options (dict, optional) – Use another smoothing filter rather than the median filter. E.g. options={“method”: “gaussian_filter”, “para1”: (1,21))}.

Returns

array_like – 2D array. Stripe-removed sinogram.

References

[1] : https://doi.org/10.1364/OE.26.028396

algotom.prep.removal.remove_stripe_based_fitting(sinogram, order=2, sigma=10, sort=False, num_chunk=1, **options)[source]

Remove stripe artifacts in a sinogram using the fitting technique, algorithm 1 in Ref. [1]. Angular direction is along the axis 0.

Parameters
  • sinogram (array_like) – 2D array. Sinogram image

  • order (int) – Polynomial fit order.

  • sigma (int) – Sigma of the Gaussian window in the x-direction. Smaller is stronger.

  • sort (bool, optional) – Apply sorting if True.

  • num_chunk (int) – Number of chunks of rows to apply the fitting.

  • options (dict, optional) – Use another smoothing filter rather than the Fourier gaussian filter. E.g. options={“method”: “gaussian_filter”, “para1”: (1,21))}.

Returns

array_like – 2D array. Stripe-removed sinogram.

References

[1] : https://doi.org/10.1364/OE.26.028396

algotom.prep.removal.remove_large_stripe(sinogram, snr=3.0, size=51, drop_ratio=0.1, norm=True, **options)[source]

Remove large stripe artifacts in a sinogram, algorithm 5 in Ref. [1]. Angular direction is along the axis 0.

Parameters
  • sinogram (array_like) – 2D array. Sinogram image

  • snr (float) – Ratio (>1.0) for stripe detection. Greater is less sensitive.

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

  • drop_ratio (float, optional) – Ratio of pixels to be dropped, which is used to reduce the possibility of the false detection of stripes.

  • norm (bool, optional) – Apply normalization if True.

  • options (dict, optional) – Use another smoothing filter rather than the median filter. E.g. options={“method”: “gaussian_filter”, “para1”: (1,21))}.

Returns

array_like – 2D array. Stripe-removed sinogram.

References

[1] : https://doi.org/10.1364/OE.26.028396

algotom.prep.removal.remove_dead_stripe(sinogram, snr=3.0, size=51, residual=True, smooth_strength=10)[source]

Remove unresponsive or fluctuating stripe artifacts in a sinogram, algorithm 6 in Ref. [1]. Angular direction is along the axis 0.

Parameters
  • sinogram (array_like) – 2D array. Sinogram image.

  • snr (float) – Ratio (>1.0) for stripe detection. Greater is less sensitive.

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

  • residual (bool, optional) – Removing residual stripes if True.

  • smooth_strength (int, optional) – Window size of the uniform filter used to detect stripes.

Returns

ndarray – 2D array. Stripe-removed sinogram.

References

[1] : https://doi.org/10.1364/OE.26.028396

algotom.prep.removal.remove_all_stripe(sinogram, snr=3.0, la_size=51, sm_size=21, drop_ratio=0.1, dim=1, **options)[source]

Remove all types of stripe artifacts in a sinogram by combining algorithm 6, 5, 4, and 3 in Ref. [1]. Angular direction is along the axis 0.

Parameters
  • sinogram (array_like) – 2D array. Sinogram image.

  • snr (float) – Ratio (>1.0) for stripe detection. Greater is less sensitive.

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

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

  • drop_ratio (float, optional) – Ratio of pixels to be dropped, which is used to reduce the possibility of the false detection of stripes.

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

  • options (dict, optional) – Use another smoothing filter rather than the median filter. E.g. options={“method”: “gaussian_filter”, “para1”: (1,21))}

Returns

array_like – 2D array. Stripe-removed sinogram.

References

[1] : https://doi.org/10.1364/OE.26.028396

algotom.prep.removal.remove_stripe_based_2d_filtering_sorting(sinogram, sigma=3, size=21, dim=1, **options)[source]

Remove stripes using a 2D low-pass filter and the sorting-based technique, algorithm in section 3.3.4 in Ref. [1]. Angular direction is along the axis 0.

Parameters
  • sinogram (array_like) – 2D array. Sinogram image.

  • sigma (int) – Sigma of the Gaussian window.

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

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

Returns

array_like – 2D array. Stripe-removed sinogram.

References

[1] : https://doi.org/10.1117/12.2530324

algotom.prep.removal.remove_stripe_based_normalization(sinogram, sigma=15, num_chunk=1, sort=True, **options)[source]

Remove stripes using the method in Ref. [1]. Angular direction is along the axis 0.

Parameters
  • sinogram (array_like) – 2D array. Sinogram image.

  • sigma (int) – Sigma of the Gaussian window.

  • num_chunk (int) – Number of chunks of rows.

  • sort (bool, optional) – Apply sorting (Ref. [2]) if True.

  • options (dict, optional) – Use another smoothing 1D-filter rather than the Gaussian filter. E.g. options={“method”: “median_filter”, “para1”: 21)}.

Returns

array_like – 2D array. Stripe-removed sinogram.

References

[1] : https://www.mcs.anl.gov/research/projects/X-ray-cmt/rivers/tutorial.html

[2] : https://doi.org/10.1364/OE.26.028396

algotom.prep.removal.remove_stripe_based_regularization(sinogram, alpha=0.0005, num_chunk=1, apply_log=True, sort=True)[source]

Remove stripes using the method in Ref. [1]. Angular direction is along the axis 0.

Parameters
  • sinogram (array_like) – 2D array. Sinogram image.

  • alpha (float) – Regularization parameter, e.g. 0.0005. Smaller is stronger.

  • num_chunk (int) – Number of chunks of rows.

  • apply_log (bool) – Apply the logarithm function to the sinogram if True.

  • sort (bool, optional) – Apply sorting (Ref. [2]) if True.

Returns

array_like – 2D array. Stripe-removed sinogram.

References

[1] : https://doi.org/10.1016/j.aml.2010.08.022

[2] : https://doi.org/10.1364/OE.26.028396

algotom.prep.removal.remove_stripe_based_fft(sinogram, u=20, n=8, v=1, sort=False)[source]

Remove stripes using the method in Ref. [1]. Angular direction is along the axis 0.

Parameters
  • sinogram (array_like) – 2D array. Sinogram image.

  • u (int) – Cutoff frequency.

  • n (int) – Filter order.

  • v (int) – Number of rows (* 2) to be applied the filter.

  • sort (bool, optional) – Apply sorting (Ref. [2]) if True.

Returns

ndarray – 2D array. Stripe-removed sinogram.

References

[1] : https://doi.org/10.1063/1.1149043

[2] : https://doi.org/10.1364/OE.26.028396

algotom.prep.removal.remove_stripe_based_wavelet_fft(sinogram, level=5, size=1, wavelet_name='db9', window_name='gaussian', sort=False, **options)[source]

Remove stripes using the method in Ref. [1]. Angular direction is along the axis 0.

Parameters
  • sinogram (array_like) – 2D array. Sinogram image.

  • level (int) – Wavelet decomposition level.

  • size (int) – Damping parameter. Larger is stronger.

  • wavelet_name (str) – Name of a wavelet. Search pywavelets API for a full list.

  • window_name (str) – High-pass window. Two options: “gaussian” or “butter”.

  • sort (bool, optional) – Apply sorting (Ref. [2]) if True.

  • options (dict, optional) – Use another smoothing filter rather than the fft-gaussian-filter. E.g. options={“method”: “gaussian_filter”, “para1”: (1,11))}

Returns

array_like – 2D array. Stripe-removed sinogram.

References

[1] : https://doi.org/10.1364/OE.17.008567

[2] : https://doi.org/10.1364/OE.26.028396

algotom.prep.removal.remove_stripe_based_interpolation(sinogram, snr=3.0, size=51, drop_ratio=0.1, norm=True, kind='linear', **options)[source]

Combination of algorithm 4, 5, and 6 in Ref. [1]. Angular direction is along the axis 0.

Parameters
  • sinogram (array_like) – 2D array. Sinogram image

  • snr (float) – Ratio (>1.0) for stripe detection. Greater is less sensitive.

  • size (int) – Window size of the median filter used to detect stripes.

  • drop_ratio (float, optional) – Ratio of pixels to be dropped, which is used to reduce the possibility of the false detection of stripes.

  • norm (bool, optional) – Apply normalization if True.

  • kind ({‘linear’, ‘cubic’, ‘quintic’}, optional) – The kind of spline interpolation to use. Default is ‘linear’.

  • options (dict, optional) – Use another smoothing filter rather than the median filter. E.g. options={“method”: “gaussian_filter”, “para1”: (1,21))}

Returns

array_like – 2D array. Stripe-removed sinogram.

References

[1] : https://doi.org/10.1364/OE.26.028396

algotom.prep.removal.check_zinger_size(mat, max_size)[source]

Check if the size of a zinger is smaller than a given size.

Parameters
  • mat (array_like) – 2D array.

  • max_size (int) – Maximum size.

Returns

bool

algotom.prep.removal.select_zinger(mat, max_size)[source]

Select zingers smaller than a certain size.

Parameters
  • mat (array_like) – 2D array.

  • max_size (int) – Maximum size in pixel.

Returns

array_like – 2D binary array.

algotom.prep.removal.remove_zinger(mat, threshold, size=2, check_size=False)[source]

Remove zinger using the method in Ref. [1], working on a projection image or sinogram image.

Parameters
  • mat (array_like) – 2D array. Projection image or sinogram image.

  • threshold (float) – Threshold to segment zingers. Smaller is more sensitive. Recommended range [0.05, 0.1].

  • size (int) – Size of a zinger.

  • check_size (bool) – Enable/disable size checking before removal.

Returns

array_like – 2D array. Zinger-removed image.

References

[1] : https://doi.org/10.1364/OE.418448

algotom.prep.removal.generate_blob_mask(flat, size, snr)[source]

Generate a binary mask of blobs from a flat-field image (Ref. [1]).

Parameters
  • flat (array_like) – 2D array. Flat-field image.

  • size (float) – Estimated size of the largest blob.

  • snr (float) – Ratio used to segment blobs.

Returns

array_like – 2D array. Binary mask.

References

[1] : https://doi.org/10.1364/OE.418448

algotom.prep.removal.remove_blob_1d(sino_1d, mask_1d)[source]

Remove blobs in one row of a sinogram, e.g. for a helical scan as shown in Ref. [1].

Parameters
  • sino_1d (array_like) – 1D array. A row of a sinogram.

  • mask_1d (array_like) – 1D binary mask.

Returns

array_like – 1D array.

Notes

The method is used to remove streak artifacts caused by blobs in a sinogram generated from a helical-scan data [1].

References

[1] : https://doi.org/10.1364/OE.418448

algotom.prep.removal.remove_blob(mat, mask)[source]

Remove blobs in an image.

Parameters
  • mat (array_like) – 2D array. Projection image or sinogram image.

  • mask (array_like) – 2D binary mask.

Returns

array_like – 2D array.