Deconv_lib
- FRC_MultiImg_RL_FFT(dset, max_iter=50, pad=None, epsilon=None, reg=0)[source]
Multi-image Richardson-Lucy deconvolution, performed using FFT. It deconvolves the entire dataset, returning a single deconvoluted image. The PSF is automatically estimated with Fourier Ring Correlation from two replicas of the same image.
- Parameters:
i_1 (np.ndarray) – ISM dataset (Nx x Ny x Nt x Nch)
max_iter (int) – Number of iteration
pad (np.array(Nx x Ny x Nch)) – Number of pixels used for zer-padding the image on each side
epsilon (float) – Minimum value of the denominator. Used to avoid division by zero (default = float.eps)
reg (float) – Regularization parameter (Tikhonov)
- Returns:
img_deconv – Deconvolved image
- Return type:
np.array(Nx x Ny)
- FRC_MultiImg_RL_FFT_2(i_1, i_2, max_iter=50, pad=None, epsilon=None, reg=0)[source]
Multi-image Richardson-Lucy deconvolution, performed using FFT. It deconvolves each image of the dataset, returning Nch deconvoluted images. The PSF is automatically estimated with Fourier Ring Correlation from two replicas of the same image.
- Parameters:
i_1 (np.array(Nx x Ny x Nch)) – ISM dataset
i_2 (np.array(Nx x Ny x Nch)) – ISM dataset
max_iter (int) – Number of iterations
pad (np.array(Nx x Ny x Nch)) – Number of pixels used for zer-padding the image on each side
epsilon (float) – Minimum value of the denominator. Used to avoid division by zero (default = float.eps)
reg (float) – Regularization parameter (Tikhonov)
- Returns:
img_deconv – Deconvolved image
- Return type:
np.array(Nx x Ny x Nch)
- MultiImg_RL_FFT(h, i, bkg=None, max_iter=50, pad=None, epsilon=None, reg=0, out='last')[source]
Multi-image Richardson-Lucy deconvolution, performed using FFT. It deconvolves the entire dataset, returning a single deconvoluted image.
- Parameters:
h (np.array(Nz x Nx x Ny x Nch)) – PSFs of the system. Nz is optional.
i (np.array(Nz x Nx x Ny x Nch)) – ISM dataset. Nz is optional.
max_iter (float) – Number of iterations
pad (int) – Number of pixels used for zero-padding the images on each side
epsilon (float) – Minimum value of the denominator. Used to avoid division by zero (default = float.eps)
reg (float) – Regularization parameter (Tikhonov)
- Returns:
img_deconv – Deconvolved image. max_iter and Nz are optional.
- Return type:
np.array(max_iter x Nz x Nx x Ny)
- MultiImg_RL_FFT_2(h, i, max_iter=50, pad=None, epsilon=None, reg=0)[source]
Multi-image Richardson-Lucy deconvolution, performed using FFT. It deconvolves each image of the dataset, returning Nch deconvoluted images.
- Parameters:
h (np.array(Nx x Ny x Nch)) – PSFs of the system
i (np.array(Nx x Ny x Nch)) – ISM dataset
max_iter (int) – Number of iterations
pad (np.array(Nx x Ny x Nch)) – Number of pixels used for zer-padding the image on each side
epsilon (float) – Minimum value of the denominator. Used to avoid division by zero (default = float.eps)
reg (float) – Regularization parameter (Tikhonov)
- Returns:
img_deconv – Deconvolved image
- Return type:
np.array(Nx x Ny x Nch)
- PSF_FRC(i_1, i_2)[source]
PSFs estimation with Fourier Ring Correlation from two replicas of the same image.
- Parameters:
i_1 (np.array(Nx x Ny x Nch)) – ISM dataset
i_2 (np.array(Nx x Ny x Nch)) – ISM dataset
- Returns:
psf_frc – Estimated PSFs
- Return type:
np.array(Nx x Ny x Nch)
- PadDataset(img, pad_width)[source]
It pads the ISM dataset on each side of each image with pad_width pixels.
- Parameters:
img (np.array(Nx x Ny x Nch)) – ISM dataset
pad_width (int) – Number of pixels used for zero-padding the images on each side
- Returns:
img_deconv – Padded dataset
- Return type:
np.array(Nx + 2*pad_width x Ny + 2*pad_width x Nch)
- UnpadDataset(img, pad_width)[source]
It removes the padding from an ISM.
- Parameters:
img (np.array(Nx + 2*pad_width x Ny + 2*pad_width x Nch)) – ISM dataset
pad_width (int) – Number of pixels used for zero-padding the images on each side
- Returns:
img_deconv – Unpadded dataset
- Return type:
np.array(Nx x Ny x Nch)
- convolution_matrix(K, I)[source]
It calculates the matrix corresponding to the convolution with kernel K, to be applied to the flattened version of the input image I
- Parameters:
K (np.array (Nx x Ny)) – Kernel of the convolution
I (np.array(Mx x My)) – Image
- Returns:
Conv_matrix (np.array( Nx + Mx - 1 x Ny + My -1 )) – Convolution matrix
Img_flatten (np.array( Mx * My )) – Padded and flattened version of the input image # CHECK SHAPE
- deconv_RL_FFT(h, i, max_iter=50, epsilon=None, reg=0, out='last')[source]
Richardson-Lucy deconvolution, performed using FFT
- Parameters:
h (np.array (Nx x Ny)) – PSF of the system
i (np.array(Mx x My)) – Image
max_iter (float) – Number of iterations
epsilon (float) – Minimum value of the denominator. Used to avoid division by zero (default = float.eps)
reg (float) – Regularization parameter (Tikhonov)
- Returns:
img_deconv – Deconvolved image
- Return type:
np.array(Mx x My)
- deconv_Wiener(h, i, reg=0, regularization='Tikhonov')[source]
Wiener deconvolution, performed using matrix multiplication
- Parameters:
h (np.array (Nx x Ny)) – PSF of the system
i (np.array(Mx x My)) – Image
reg (float) – Regularization parameter
regularization (str) – Method for regularizing the algorithm ‘Tikhonov’ or ‘Laplace’
- Returns:
img_deconv – Deconvolved image
- Return type:
np.array(Mx x My)
- deconv_Wiener_FFT(h, i, reg=0)[source]
Wiener deconvolution, performed using FFT
- Parameters:
h (np.array (Nx x Ny)) – PSF of the system
i (np.array(Mx x My)) – Image
reg (float) – Regularization parameter (Tikhonov)
- Returns:
img_deconv – Deconvolved image
- Return type:
np.array(Mx x My)
- disk2d(X, Y, mux, muy, T)[source]
2D disk function
- Parameters:
X (np.array (Nx x Ny)) – meshgrid of the x-coordinate
Y (np.array (Nx x Ny)) – meshgrid of the y-coordinate
mux (int) – center on the x-axis
muy (int) – center on the y-axis
T (float) – radius of the disk
- Returns:
disk – Disk
- Return type:
np.array(Nx x Ny)
- gauss2d(X, Y, mux, muy, sigma)[source]
2D radially symmetric Gaussian function
- Parameters:
x (np.array (Nx x Ny)) – meshgrid of the x-coordinate
y (np.array (Nx x Ny)) – meshgrid of the y-coordinate
mux (int) – center on the x-axis
muy (int) – center on the y-axis
sigma (float) – dev. standard
- Returns:
gauss – Gaussian distribution
- Return type:
np.array(Nx x Ny)