API Reference
SeqFISH_ADCG.fit_img_tiles
— Functionfit_img_tiles(img,
main_tile_width :: Int64,
tile_overlap :: Int64,
sigma_lb :: Float64,
sigma_ub :: Float64,
tau :: Float64,
final_loss_improvement :: Float64,
min_weight :: Float64,
max_iters :: Int64,
max_cd_iters :: Int64,
noise_mean :: Float64,
fit_alg :: AbstractString = "ADCG"
)
Arguments:
img
: a 2048x2048 image to fitmain_tile_width
: the width of the main tiletile_overlap
: width of the overlaps of tiles with their neighborssigma_lb
: the lowest allowed σ of a PSFsigma_ub
: the highest allowed σ of a PSFtau
: not used in current versionfinal_loss_improvement
: ADCG terminates when the improvement in the loss function in subsequent iterations is less than thismin_weight
: ADCG terminates when the next best PSF to add to the model has weight less than thismax_iters
: The maximum number of points to add in a model of a tilemax_cd_iters
: the maximum number of iterations of gradient descent to run after adding a PSF to the model to adjust the parameters of all PSFs in the modelnoise_mean
: the noise mean is subtracted from the image before fittingfit_alg
: 'ADCG' or 'DAO', uses the respective algorithm. Only ADCG is thorougly tested. Must be set as a keyword argument.
Returns:
- DataFrame of points included in model at the end of the ADCG run
records
object of points obtained at intermediate steps in the fitting process
Fits gaussian point spread functions on a square image of arbitrary sized by breaking it up into overlapping tiles of user specified width and overlap, then running ADCG on each tile and aggregating the results. It is necessary to call remove duplicates on the resultant image to remove the duplicates in the regions of overlapping tiles.
SeqFISH_ADCG.fit_2048x2048_img_tiles
— Functionfit_2048x2048_img_tiles(img,
sigma_lb :: Float64,
sigma_ub :: Float64,
tau :: Float64,
final_loss_improvement :: Float64,
min_weight :: Float64,
max_iters :: Int64,
max_cd_iters :: Int64,
noise_mean :: Float64,
fit_alg :: AbstractString = "ADCG"
)
Arguments:
img
: a 2048x2048 image to fitsigma_lb
: the lowest allowed σ of a PSFsigma_ub
: the highest allowed σ of a PSFtau
: not used in current versionfinal_loss_improvement
: ADCG terminates when the improvement in the loss function in subsequent iterations is less than thismin_weight
: ADCG terminates when the next best PSF to add to the model has weight less than thismax_iters
: The maximum number of points to add in a model of a tilemax_cd_iters
: the maximum number of iterations of gradient descent to run after adding a PSF to the model to adjust the parameters of all PSFs in the modelnoise_mean
: the noise mean is subtracted from the image before fittingfit_alg
: 'ADCG' or 'DAO', uses the respective algorithm. Only ADCG is thorougly tested. Must be set as a keyword argument.
Returns:
- DataFrame of points included in model at the end of the ADCG run
- records object of points obtained at intermediate steps in the fitting process
Fits gaussian point spread functions in a 2048x2048 pixel image with ADCG by splitting it into overlapping 70x70 pixel tiles.
SeqFISH_ADCG.remove_duplicates
— Functionremove_duplicates(points :: DataFrame,
img,
sigma_lb :: Float64,
sigma_ub :: Float64,
tau :: Float64,
noise_mean :: Float64,
min_allowed_separation :: Float64,
dims :: Int64 = 2
)
Arguments:
img
: a 2048x2048 image to fitsigma_lb
: the lowest allowed σ of a PSFsigma_ub
: the highest allowed σ of a PSFtau
: not used in current versionnoise_mean
: the noise mean is subtracted from the image before fittingmin_allowed_separation
: Dots within this distance of each other are considered duplicatesdims
: The dimension of the data
Returns:
- DataFrame of points without duplicates.
Thins duplicates within min_allowed_separtion
of each other from an image. Keeping only best dots such that all dots returned are at least min_allowed_separation
from their nearest neighbor. This is necessary when fit by a tiled ADCG where the tiles overlap.
SeqFISH_ADCG.fit_tile
— Functionfit_tile(inputs)
Arguments:
inputs
: A tuple of inputs with entries:tile
: An image tile to perform ADCG on.sigma_lb
: the lowest allowed value of the width parameter of dots.sigma_ub
: the highest allowed value of the width parameter of dots.noise_mean
: estimated mean of noise. Pixel values below this are set to zero.tau
: not used in this versionfinal_loss_improvement
: Terminate ADCG when the objective improves by less than this value in one iterationmin_weight
: The minimum allowed weight of a PSF in the image modelmax_iters
: The maximum number of ADCG iterations, or number PSFs to add to the model.max_cd_iterations
: the maximum number of times to perform gradient descent for the parameter values of all dots.fit_alg
: 'ADCG' or 'DAO', uses the respective algorithm. Only ADCG is thorougly tested.
Returns:
- records object of points obtained at intermediate steps in the fitting process
Runs ADCG on a single 2D tile.
SeqFISH_ADCG.fit_stack
— Functionfit_stack(inputs)
Arguments:
inputs
: A tuple of inputs with entries:stack
: An image stack to perform ADCG on.sigma_xy_lb
: the lowest allowed value of the width parameter of dots in the xy plane.sigma_xy_ub
: the highest allowed value of the width parameter of dots in the xy plane.sigma_z_lb
: the lowest allowed value of the width parameter of dots in the z axis.sigma_z_ub
: the hightest allowed value of the width parameter of dots in the z axis.final_loss_improvement
: Terminate ADCG when the objective improves by less than this value in one iterationmin_weight
: The minimum allowed weight of a PSF in the image modelmax_iters
: The maximum number of ADCG iterations, or number PSFs to add to the model.max_cd_iterations
: the maximum number of times to perform gradient descent for the parameter values of all dots.fit_alg
: 'ADCG' or 'DAO', uses the respective algorithm. Only ADCG is thorougly tested. Must be set as a keyword argument.
Returns:
- records object of points obtained at intermediate steps in the fitting process
Fits a model of a 3D image stack as a linear combination of point spread functions using ADCG.
SeqFISH_ADCG.fit_stack_tiles
— Functionfit_stack_tiles(
img_stack,
main_tile_width :: Int64,
tile_overlap :: Int64,
tile_depth :: Int64,
tile_depth_overhang :: Int64,
sigma_xy_lb :: Float64,
sigma_xy_ub :: Float64,
sigma_z_lb :: Float64,
sigma_z_ub :: Float64,
final_loss_improvement :: Float64,
min_weight :: Float64,
max_iters :: Int64,
max_cd_iters :: Int64,
fit_alg = "ADCG"
)
Arguments:
img
: a 2048x2048 image to fitmain_tile_width
: the width of the main tiletile_overlap
: width of the overlaps of tiles with their neighborstile_depth
: the z depth of main tiles`tile_depth_overhang
: the overlap/overhang of tiles in the z axissigma_xy_lb
: the lowest allowed lateral σ of a PSFsigma_xy_ub
: the highest allowed lateral σ of a PSFsigma_z_lb
: the lowest allowed axial σ of a PSFsigma_z_ub
: the highest allowed axial σ of a PSFfinal_loss_improvement
: ADCG terminates when the improvement in the loss function in subsequent iterations is less than thismin_weight
: ADCG terminates when the next best PSF to add to the model has weight less than thismax_iters
: the maximum number of iterations in which a new PSF may be added to the model of a tile (i.e. the maximum PSFs in a tile)max_cd_iters
: the maximum number of iterations of gradient descent to run after adding a PSF to the model to adjust the parameters of all PSFs in the modelfit_alg
: 'ADCG' or 'DAO', uses the respective algorithm. Only ADCG is thorougly tested. Must be set as a keyword argument.
Returns:
- DataFrame of points included in model at the end of the ADCG run
- records object of points obtained at intermediate steps in the fitting process
Fits gaussian point spread functions using ADCG on a square image of arbitrary sized by breaking it up into overlapping tiles of user specified width and overlap, then running ADCG on each tile and aggregating the results. It is necessary to call remove duplicates on the resultant image to remove the duplicates in the regions of overlapping tiles.
SeqFISH_ADCG.get_mw_dots
— Functionget_mw_dots(records :: DataFrame, w :: Real)
Look up the ADCG result at a minimum weight larger than the final minimum weight given for an ADCG run.
Returns a dataframe of results.