tomocupy.remove_stripe
Functions:
|
Remove stripes with wavelet filtering |
- class tomocupy.remove_stripe.DWTForward(wave='db1')[source]
Bases:
object
Performs a 2d DWT Forward decomposition of an image
- Parameters:
wave (str) – Which wavelet to use.
- apply(x)[source]
Forward pass of the DWT.
- Parameters:
x (array) – Input of shape \((N, C_{in}, H_{in}, W_{in})\)
- Returns:
- (yl, yh)
tuple of lowpass (yl) and bandpass (yh) coefficients. yh is a list of scale coefficients. yl has shape \((N, C_{in}, H_{in}', W_{in}')\) and yh has shape \(list(N, C_{in}, 3, H_{in}'', W_{in}'')\). The new dimension in yh iterates over the LH, HL and HH coefficients.
Note
\(H_{in}', W_{in}', H_{in}'', W_{in}''\) denote the correctly downsampled shapes of the DWT pyramid.
- class tomocupy.remove_stripe.DWTInverse(wave='db1')[source]
Bases:
object
Performs a 2d DWT Inverse reconstruction of an image
- Parameters:
wave (str) – Which wavelet to use.
- apply(coeffs)[source]
- Parameters:
coeffs (yl, yh) – tuple of lowpass and bandpass coefficients, where: yl is a lowpass array of shape \((N, C_{in}, H_{in}', W_{in}')\) and yh is a list of bandpass arrays of shape \(list(N, C_{in}, 3, H_{in}'', W_{in}'')\). I.e. should match the format returned by DWTForward
- Returns:
Reconstructed input of shape \((N, C_{in}, H_{in}, W_{in})\)
Note
\(H_{in}', W_{in}', H_{in}'', W_{in}''\) denote the correctly downsampled shapes of the DWT pyramid.
- tomocupy.remove_stripe.afb1d(x, h0, h1='zero', dim=-1)[source]
1D analysis filter bank (along one dimension only) of an image
- Parameters:
x (array) (4D input with the last two dimensions the spatial input)
h0 (array) (4D input for the lowpass filter. Should have shape (1, 1,) – h, 1) or (1, 1, 1, w)
h1 (array) (4D input for the highpass filter. Should have shape (1, 1,) – h, 1) or (1, 1, 1, w)
dim (int) - dimension of filtering. d=2 is for a vertical filter (called – column filtering but filters across the rows). d=3 is for a horizontal filter, (called row filtering but filters across the columns).
- Returns:
lohi (lowpass and highpass subbands concatenated along the channel) – dimension
- tomocupy.remove_stripe.remove_all_stripe(tomo, snr=3, la_size=61, sm_size=21, dim=1)[source]
Remove all types of stripe artifacts from sinogram using Nghia Vo’s approach [B3] (combination of algorithm 3,4,5, and 6).
- Parameters:
tomo (ndarray) – 3D tomographic data.
snr (float) – Ratio used to locate large stripes. 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.
dim ({1, 2}, optional) – Dimension of the window.
- Returns:
ndarray – Corrected 3D tomographic data.
- tomocupy.remove_stripe.remove_stripe_fw(data, sigma, wname, level)[source]
Remove stripes with wavelet filtering