get_trans_masks

pysaber.get_trans_masks(rad, edge, tran_pars=None, pad=[1, 1], mask=None, bdary_mask=5.0, perp_mask=5.0)

Function to compute transmission function and masks for a radiograph with a single straight edge or two mutually perpendicular edges.

For a measured radiograph consisting of a straight sharp edge or two mutually perpendicular edges, get the transmission function, mask for transmission function, and mask for radiograph.

Parameters
  • rad (numpy.ndarray) – Normalized radiograph of a straight sharp edge or two mutually perpendicular edges.

  • edge (str) – Used to indicate whether there is a single straight edge or two mutually perpendicular edges in each radiograph. If edge is perpendicular, then each radiograph is assumed to have two mutually perpendicular edges. If it is straight, then each radiograph is assumed to have a single straight edge. Only perpendicular and straight are legal choices for edge.

  • tran_pars (list) – List containing the estimated parameters of the transmission function for the input radiograph. It consists of two parameters of type float. These float values give the low and high values respectively of the transmission function. Note that the transmission function is the normalized radiograph image that would have resulted in the absence of blur and noise. If not specified (or specified as None), then the best fitting transmission function parameters are estimated using RANSAC regression. If specified as [0,1], this function returns the ideal transmission function.

  • pad (list) – List of two integers that determine the amount of padding that must be applied to the radiographs to reduce aliasing during convolution. The number of rows/columns after padding is equal to pad_factor[0]/pad_factor[1] times the number of rows/columns in each radiograph before padding. For example, if the first element in pad_factor is 2, then the radiograph is padded to twice its size along the first dimension.

  • mask (numpy.ndarray) – Boolean mask of the same shape as the radiograph that is used to exclude pixels from blur estimation. This is in addition to the masking specified by bdary_mask and perp_mask. An example use case is if some pixels in the radiograph rad are bad, then those pixels can be excluded from blur estimation by setting the corresponding entries in mask to False and True otherwise. If None, no user specified mask is used.

  • bdary_mask (float) – Percentage of image region in the radiographs as measured from the outer edge going inwards that must be excluded from blur estimation. Pixels are excluded (or masked) beginning from the outermost periphery of the image and working inwards until the specified percentage of pixels is reached.

  • perp_mask (float) – Percentage of circular region to ignore during blur estimation around the intersecting corner of two perpendicular edges. Ignored if edge is straight.

Returns

Tuple of three arrays each of type numpy.ndarray. The first array is the transmission function, which is the ideal readiograph in the absence of source and detector blur. The second and third arrays are the masks for the transmission function and radiograph respectively. The mask array indicates what pixels must be included (pixel value of True) or excluded (pixel value of False) during blur estimation.

Return type

tuple