API Reference

SeqFISH_ADCG.fit_img_tilesFunction
fit_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 fit
  • main_tile_width : the width of the main tile
  • tile_overlap : width of the overlaps of tiles with their neighbors
  • sigma_lb : the lowest allowed σ of a PSF
  • sigma_ub : the highest allowed σ of a PSF
  • tau : not used in current version
  • final_loss_improvement : ADCG terminates when the improvement in the loss function in subsequent iterations is less than this
  • min_weight : ADCG terminates when the next best PSF to add to the model has weight less than this
  • max_iters : The maximum number of points to add in a model of 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 model
  • noise_mean : the noise mean is subtracted from the image before fitting
  • fit_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.

source
SeqFISH_ADCG.fit_2048x2048_img_tilesFunction
fit_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 fit
  • sigma_lb : the lowest allowed σ of a PSF
  • sigma_ub : the highest allowed σ of a PSF
  • tau : not used in current version
  • final_loss_improvement : ADCG terminates when the improvement in the loss function in subsequent iterations is less than this
  • min_weight : ADCG terminates when the next best PSF to add to the model has weight less than this
  • max_iters : The maximum number of points to add in a model of 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 model
  • noise_mean : the noise mean is subtracted from the image before fitting
  • fit_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.

source
SeqFISH_ADCG.remove_duplicatesFunction
remove_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 fit
  • sigma_lb : the lowest allowed σ of a PSF
  • sigma_ub : the highest allowed σ of a PSF
  • tau : not used in current version
  • noise_mean : the noise mean is subtracted from the image before fitting
  • min_allowed_separation : Dots within this distance of each other are considered duplicates
  • dims : 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.

source
SeqFISH_ADCG.fit_tileFunction
fit_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 version
    • final_loss_improvement : Terminate ADCG when the objective improves by less than this value in one iteration
    • min_weight : The minimum allowed weight of a PSF in the image model
    • max_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.

source
SeqFISH_ADCG.fit_stackFunction
fit_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 iteration
    • min_weight : The minimum allowed weight of a PSF in the image model
    • max_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.

source
SeqFISH_ADCG.fit_stack_tilesFunction
fit_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 fit
  • main_tile_width : the width of the main tile
  • tile_overlap : width of the overlaps of tiles with their neighbors
  • tile_depth : the z depth of main tiles`
  • tile_depth_overhang : the overlap/overhang of tiles in the z axis
  • sigma_xy_lb : the lowest allowed lateral σ of a PSF
  • sigma_xy_ub : the highest allowed lateral σ of a PSF
  • sigma_z_lb : the lowest allowed axial σ of a PSF
  • sigma_z_ub : the highest allowed axial σ of a PSF
  • final_loss_improvement : ADCG terminates when the improvement in the loss function in subsequent iterations is less than this
  • min_weight : ADCG terminates when the next best PSF to add to the model has weight less than this
  • max_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 model
  • fit_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.

source
SeqFISH_ADCG.get_mw_dotsFunction
get_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.

source