least_squares_deblur

pysaber.least_squares_deblur(rad, sod, odd, pix_wid, src_pars, det_pars, reg_par, init_rad=None, weights=None, thresh=0.0001)

Function to reduce blur (deblur) in radiographs using a regularized least squares iterative algorithm.

Parameters
  • rad (numpy.ndarray) – Normalized radiograph to deblur

  • sod (float) – Source to object distance (SOD) of the radiograph

  • odd (float) – Object to detector distance (ODD) of the radiograph

  • pix_wid (float) – Effective width of each detector pixel. Note that this is the effective pixel size given by dividing the physical width of each detector pixel by the zoom factor of the optical lens.

  • src_pars (dict) – Dictionary containing the estimated parameters of X-ray source PSF. It consists of several key-value pairs. The value for key source_FWHM_x_axis is the full width half maximum (FWHM) of the source PSF along the x-axis (i.e., second numpy.ndarray dimension). The value for key source_FWHM_y_axis is the FWHM of source PSF along the y-axis (i.e., first numpy.ndarray dimension). All FWHMs are for the source PSF in the plane of the X-ray source (and not the plane of the detector). The value for key cutoff_FWHM_multiplier decides the non-zero spatial extent of the source PSF. The PSF is clipped to zero beginning at a distance, as measured from the PSF’s origin, equal to the maximum of src_pars['cutoff_FWHM_multiplier'] times src_pars['source_FWHM_x_axis']/2 and src_pars['cutoff_FWHM_multiplier'] times src_pars['source_FWHM_y_axis']/2.

  • det_pars (dict) – Dictionary containing the estimated parameters of detector PSF. It consists of several key-value pairs. The value for key detector_FWHM_1 is the FWHM of the first density function in the mixture density model for detector blur. The first density function is the most dominant part of detector blur. The value for key detector_FWHM_2 is the FWHM of the second density function in the mixture density model. This density function has the largest FWHM and models the long running tails of the detector blur’s PSF. The value for key detector_weight_1 is between 0 and 1 and is a measure of the amount of contribution of the first density function to the detector blur. The values for keys cutoff_FWHM_1_multiplier and cutoff_FWHM_2_multiplier decide the non-zero spatial extent of the detector PSF. The PSF is clipped to zero beginning at a distance, as measured from the PSF’s origin, equal to the maximum of det_pars['cutoff_FWHM_1_multiplier'] times det_pars['detector_FWHM_1']/2 and det_pars['cutoff_FWHM_2_multiplier'] times det_pars['detector_FWHM_2']/2.

  • reg_par (float) – Regularization parameter for the least squares deblurring algorithm. Noise and ringing artifacts in the deblurred radiograph decreases with increasing values for reg_par and vice versa. But, note that increasing reg_par can also result in excessive blurring due to over-regulization. It is recommended to empirically choose this parameter by increasing or decreasing it by a factor, greater than one (such as 2 or 10), until the desired image quality is achieved.

  • init_rad (numpy.ndarray) – Initial estimate for the deblurred radiograph. If set to None, then the blurred radiograph is used as an initial estimate. If not None, then init_rad must be a numpy.ndarray of the same shape as the radiograph rad.

  • weights (numpy.ndarray) – Array of weights of the same shape as rad that is useful to model measurement noise. It can be used to increase or decrease the influence of a particular pixel of rad in the forward model cost function. If set to None, every pixel is assigned the same weight of 1 in the cost function.

  • thresh (float) – Convergence threshold for the minimizer used to deblur the input radiograph. The iterations stop when the ratio of the reduction in the error function (cost value) and the magnitude of the error function is lower than thresh. This is the parameter ftol that is specified in the options parameter of scipy.optimize.minimize. The optimizer used is L-BFGS-B.

Returns

Deblurred radiograph using regularized least squares algorithm.

Return type

numpy.ndarray