SMLMBoxer
Documentation for SMLMBoxer.
SMLMBoxer.convolveSMLMBoxer.dog_filterSMLMBoxer.dog_kernelSMLMBoxer.fillbox!SMLMBoxer.findlocalmaxSMLMBoxer.gaussian_2dSMLMBoxer.genlocalmaximageSMLMBoxer.getboxesSMLMBoxer.getboxstackSMLMBoxer.maxima2coordsSMLMBoxer.removeoverlapSMLMBoxer.reshape_for_flux
SMLMBoxer.convolve — Methodconvolve(imagestack, kernel; use_gpu=false)Convolve imagestack with given kernel.
Arguments
imagestack: Input array of image datakernel: Kernel to convolve with
Keyword Arguments
use_gpu: Whether to use GPU
Returns
filtered_stack: Convolved image stack
SMLMBoxer.dog_filter — Methoddog_filter(imagestack, args)Apply DoG filter to imagestack based on args.
Arguments
imagestack: Input array of image dataargs: Arguments with sigma values
Returns
filtered_stack: Filtered image stack
SMLMBoxer.dog_kernel — Methoddog_kernel(s1, s2)
Compute difference of Gaussian kernels.
Arguments
sigma_small: Sigma for small Gaussiansigma_large: Sigma for large Gaussian
Returns
dog: Difference of Gaussians kernel
SMLMBoxer.fillbox! — Methodfillbox!(box, imagestack, row, col, im, boxsize)
Fill a box with a crop from the imagestack.
Arguments
box: Array to fill with box cropimagestack: Input image stackrow,col,im: Coords for cropboxsize: Size of box
Returns
boxcoords: Upper Left corners of boxes N x (row, col, im)
SMLMBoxer.findlocalmax — Methodfindlocalmax(imagestack, kernelsize; minval=0.0, use_gpu=false)
Find the coordinates of local maxima in an image.
Arguments
imagestack: An array of real numbers representing the image data.kernelsize: The size of the kernel used to identify local maxima.
Keyword Arguments
minval: The minimum value a local maximum must have to be considered valid (default: 0.0).use_gpu: Whether or not to use GPU acceleration (default: false).
Returns
coords: The coordinates of the local maxima in the image.
SMLMBoxer.gaussian_2d — Methodgaussian_2d(sigma, ksize)
Create a 2D Gaussian kernel.
Arguments
sigma: Standard deviationkernelsize: Kernel size
Returns
kernel: Normalized 2D Gaussian kernel
SMLMBoxer.genlocalmaximage — Methodgenlocalmaximage(imagestack, kernelsize; minval=0.0, use_gpu=false)
Generate an image highlighting the local maxima.
Arguments
imagestack: An array of real numbers representing the image data.kernelsize: The size of the kernel used to identify local maxima.
Keyword Arguments
minval: The minimum value a local maximum must have to be considered valid (default: 0.0).use_gpu: Whether or not to use GPU acceleration (default: false).
Returns
localmaximage: An image with local maxima highlighted.
SMLMBoxer.getboxes — Methodgetboxes(; kwargs...)Detect particles/blobs in a multidimensional image stack and return coordinates and boxed regions centered around local maxima.
Arguments
imagestack::AbstractArray{<:Real}: The input image stack. Should be 2D or 3D.boxsize::Int: Size of the box to cut out around each local maximum (pixels).overlap::Real: Amount of overap allowed between boxes (pixels).sigma_small::Real: Sigma for small Gaussian blur kernel (pixels).sigma_large::Real: Sigma for large Gaussian blur kernel (pixels).minval::Real: Minimum value to consider as a local maximum.use_gpu::Bool: Perform convolution and local max finding on GPU.
Returns
boxstack::AbstractArray{<:Real}: Array with dimensions (boxsize, boxsize, nboxes). Each image in the stack contains a small subregion from imagestack centered around a local maximumboxcoords::Matrix{Float32}: Coordinates of boxes N x (row, col, frame).maxcoords::Matrix{Float32}: Coordinates of boxes N x (row, col, frame).
Details on filtering
The image stack is convolved with a difference of Gaussians (DoG) filter to identify blobs and local maxima. The DoG is computed from two Gaussian kernels with standard deviations sigma_small and sigma_large.
The convolution is performed either on CPU or GPU, depending on use_gpu. After filtering, local maxima above minval are identified. Boxes are cut out around each maximum, excluding overlaps.
Examples
boxes, boxcoords, maxcoords = getboxes(imagestack, boxsize=7, overlap=2.0,
sigma_small=1.0, sigma_large=2.0)SMLMBoxer.getboxstack — Methodgetboxstack(imagestack, coords, args::GetBoxesArgs)
Cut out box regions from imagestack centered on coords.
Arguments
imagestack: Input image stackcoords: Coords of box centersargs: Parameters
Returns
boxstack: Array with box crops from imagestack
SMLMBoxer.maxima2coords — Methodmaxima2coords(imagestack)
Get coordinates of all non-zero pixels in input stack
Arguments
imagestack: Input image stack
Returns
coords: List of coords for each frame
SMLMBoxer.removeoverlap — Methodremoveoverlap(coords, args)
Remove overlapping coords based on distance.
Arguments
coords: List of coordsargs: Parameters
Returns
coords: Coords with overlaps removed
SMLMBoxer.reshape_for_flux — Methodreshapeforflux(arr::AbstractArray)
Reshape array to have singleton dims for Flux.jl convolution.
Arguments
arr: Input array, must be 2D or 3D
Returns
- Reshaped array with added singleton dimensions