Proccessing Functions

Created on Wed Aug 14 21:54:05 2019

@author: jlb269

process.CellExtract(img, numCols, numRows, imgtype='')

Performs extraction of individual cells.

Finds lines in cell or module image and orients the image normal to the frame.

Args:

img (numpy.ndarray): An image array numCols (int): number of cells across in module image numRows (int): number of cells down in module image imgtype (str): ‘UVF’ UV Fluorescence Image

‘gradient’ for unequal intensity across the image ‘lowcon’ low contrast between cell and background

or PL images without background subtraction

Returns:

list of numpy.ndarrays

process.GetLMError(x, *args)

Error function for detecting lens distortion using the image mask Called by autoLensCorrect function

process.Mask(img, imgtype='')

Creates a mask of the cell area.

Thresholds the image to create a binary mask, with options for images with a gradient or low contrast.

Args:

img (numpy.ndarray): An image array imgtype (str): ‘UVF’ UV Fluorescence Image

‘gradient’ for unequal intensity across the image ‘lowcon’ low contrast between cell and background

or PL images without background subtraction

Returns:

numpy.ndarray

process.PlanarIndex(img, imgtype='')

Performs re-orientation of module in frame.

Broadly, this function performs tasks of filtering, edge detection, corner detection, perspective transformation.

Args:

img (numpy.ndarray): An image array

Returns:

list of numpy.ndarray

process.RotateImage(img, imgtype='')

Performs rotation of an image.

Finds lines in cell or module image and orients the image normal to the frame.

Args:

img (numpy.ndarray): An image array imgtype (str): ‘UVF’ UV Fluorescence Image

‘gradient’ for unequal intensity across the image ‘lowcon’ low contrast between cell and background

or PL images without background subtraction

Returns:

numpy.ndarray

process.autoLensCorrect(mask)

Obtains lens distortion correction parameters for an image mask

Uses the GetLMError function to find optimal n, f based on error of linear fitting on sides of convex hull. Best results on module images without darkened cells or dark cell edges. Recommended to find n,f on subset of images, then apply to a larger dataset.

Args:

img (numpy.ndarray): input image array

Returns:

n (float): barrel distortion factor f (float): lens focal length

process.lensCorrect(img, n, f)

Removes barrel or pincushion distortion from an image

Uses input parameters to remove lens distortion. Input parameters can be found with pipelines.GetLensCorrectParams function

Args:

img (numpy.ndarray): input image array n (float): barrel distortion factor f (float): lens focal length

Returns:

numpy.ndarray: array of the lens corrected image