Here is an example for spot detection in scopyon.analysis
. This module requires scikit-image
(https://scikit-image.org/).
In [1]:
import scopyon
In [2]:
config = scopyon.DefaultConfiguration()
config.default.detector.exposure_time = 33.0e-3
pixel_length = config.default.detector.pixel_length / config.default.magnification
L_2 = config.default.detector.image_size[0] * pixel_length * 0.5
In [3]:
import numpy.random
rng = numpy.random.RandomState(123)
N = 100
inputs = rng.uniform(-L_2, +L_2, size=(N, 2))
In [4]:
img, infodict = scopyon.form_image(inputs, config=config, rng=rng, full_output=True)
Detect spots in the given image. See also http://scikit-image.org/docs/dev/api/skimage.feature.html#skimage.feature.blob_log for details. The default ROI size is 12x12.
In [5]:
spots = scopyon.analysis.spot_detection(
img.as_array(), min_sigma=1, max_sigma=4, threshold=50.0, overlap=0.5)
Overlay ROIs detected. Red shows spots detected, and green does true spots.
In [6]:
r = 6
shapes = [dict(x=data[2], y=data[3], sigma=r, color='green')
for data in infodict['true_data'].values()]
shapes += [dict(x=spot[0], y=spot[1], sigma=r, color='red')
for spot in spots]
img.show(shapes=shapes)