ImageProcessing.refine_locations¶
- ImageProcessing.refine_locations(image, image_subs, stats=None, snrs=None)[source]¶
This method is used to estimate the subpixel centers of blobs in an image given the pixel level location of the blobs.
The method operates by performing a user specified centroiding algorithm on the image area surrounding the specified pixel level centers of the points of interest. The centroiding algorithm should typically be a subclass of
PointSpreadFunction
, however it can be any object with afit
method that inputs 3 array like parameters with the first two being pixel locations and the last being DN values and returns a object with acentroid
attribute which provides the (x, y) location of the centroid. The centroiding algorithm is specified using thecentroiding
attribute. The size of the area considered in the centroiding algorithm can be specified in thecentroid_size
attribute.This method returns both the subpixel centers of the points of interest as well as the illumination values of the pixels containing the subpixel centers of the points of interest. Optionally, stats about the blobs that the centroid was fit to and then full centroid fit can be returned if
stats
andsnrs
are not None andsave_psf
is set to True, respectively.Note that if a centroid fit is unsuccessful then no information is returned for that point. Therefore the output arrays lengths will be less than or equal to the length of the input array.
This method is designed to be used in conjunction with the
find_poi_in_roi()
method; however, it can be used with any rough identification method so long as the input format is correct.- Parameters:
image (ndarray) – The image to be processed
image_subs (Iterable[ndarray]) – The pixel level locations of interest to be refined
stats (List[ndarray] | None) – An optional input of stats about the blobs. This is not used in this function but is passed through, removing any blobs where a centroid was not found.
snrs (List[ndarray] | None) – An optional input of signal to noise ratios from the blobs. This is not used in this function but is passed through, removing any blobs where a centroid was not found.
- Returns:
The subpixel centers of the points of interest as well as the illumination values (col, row)
- Return type:
Tuple[ndarray, ndarray] | Tuple[ndarray, ndarray, ndarray] | Tuple[ndarray, ndarray, List[ndarray], List[ndarray]] | Tuple[ndarray, ndarray, ndarray, List[ndarray], List[ndarray]]