Library

SMLMData.SMLD2DType
SMLD2D

Structure containing 2D localization data

# Fields
- connectID: integer ID associating localizations
- x: x position 
- y: y position
- σ_x: standard error uncertainty in x
- σ_y: standard error uncertainty in y
- photons: total photons 
- σ_photons: standard error uncertainty in σ_photons
- bg: fit fluorescence background (photons/pixel)
- σ_bg: standard error uncertainty in bg
- framenum: integer framenumber within a dataset
- datasetnum: integer dataset number
- datasize::Vector{Int}: size of image area
- nframes: integer frames per dataset
- ndatasets: number of dataasets
- datafields: bookeeping - do not modify
source
SMLMData.SMLD2DMethod
SMLD2D(data::DataFrames.DataFrame)

Constructor to generate an smld from a data frame.

Description

This is a constructor for the SMLD2D struct which allows you to populate the structure with data defined in the dataframe data. The intention is that a .csv table can be organized with localizations on each row as [datasetnum, framenum, x, y, σ_x, σ_y], loaded using the CSV package, and placed into a dataframe with the DataFrames package.

source
SMLMData.SMLD2DMethod
SMLD2D(nlocalizations::Int)

Constructor to generate an empty smld with a specific size.

Description

This is a constructor for the SMLD2D struct which allows you to populate the structure with undefined values for a predefined number of localizations.

source
SMLMData.SMLD3DType
SMLD3D

Structure containing 3D localization data

# Fields
- connectID: integer ID associating localizations
- x: x position 
- y: y position
- z: z position
- σ_x: standard error in x position
- σ_y: standard error in y position
- σ_z: standard error in z position
- photons: total photons 
- σ_photons: standard error uncertainty in σ_photons
- bg: fit fluorescence background (photons/pixel)
- σ_bg: standard error uncertainty in bg
- framenum: integer framenumber within a dataset
- datasetnum: integer dataset number
- datasize::Vector{Int}: size of image area
- nframes: integer frames per dataset
- ndatasets: number of dataasets
- datafields: bookeeping - do not modify
source
SMLMData.SMLD3DMethod
SMLD3D(data::DataFrames.DataFrame)

Constructor to generate an smld from a data frame.

Description

This is a constructor for the SMLD3D struct which allows you to populate the structure with data defined in the dataframe data. The intention is that a .csv table can be organized with localizations on each row as [datasetnum, framenum, x, y, z, σ_x, σ_y, σ_z], loaded using the CSV package, and placed into a dataframe with the DataFrames package.

source
SMLMData.SMLD3DMethod
SMLD3D(nlocalizations::Int)

Constructor to generate an empty smld with a specific size.

Description

This is a constructor for the SMLD3D struct which allows you to populate the structure with undefined values for a predefined number of localizations.

source
Base.getindexMethod
Base.getindex(smld::SMLMData.SMLD, ind)

Returns the requested localization from smld.

source
Base.lengthMethod
Base.length(smld::SMLMData.SMLD)

Returns the number of localizations in smld.

source
SMLMData.addoffset!Method
addoffset!(smld::SMLD, offset::Vector{Float64})

Add an offset elementwise to each localization coordinate in smld.

Inputs

-offset: Vector describing the offset. (for SMLD2D: [offsety; offsetx], for SMLD3D: [offsety; offsetx; offset_z])

source
SMLMData.catsmldMethod
smld = catsmld(smld1::T, smld2::T) where {T<:SMLMData.SMLD}

Concatenate smld1 and smld2.

Description

This method concatenates the datafields of smld1 and smld2 (as defined by smld1.datafields) into an output smld. The non-data fields are taken from smld1 and copied into smld.

source
SMLMData.circleimMethod
image = circleim(smld::SMLMData.SMLD2D, pxsize::Float64, filename::String;
                 pxsize_out::Float64 = 0.005)

Generate and save a circle image.

Description

This method is a wrapper for makecircleim() which uses different inputs arguments and saves the image.

Inputs

-smld: SMLMData.SMLD2D data structure containing localizations. -pxsize: Pixel size of localizations in smld. (micrometers) -pxsize_out: Desired output pixel size. (micrometers)

source
SMLMData.circleimMethod
image = circleim(smld::SMLMData.SMLD2D, pxsize::Float64;
                 pxsize_out::Float64 = 0.005)

Generate and save a circle image.

Description

This method is a wrapper for makecircleim() with modified inputs.

Inputs

-smld: SMLMData.SMLD2D data structure containing localizations. -pxsize: Pixel size of localizations in smld. (micrometers) -pxsize_out: Desired output pixel size. (micrometers)

source
SMLMData.contraststretch!Method
contraststretch!(image::Matrix{Float64};
                 minval::Float64 = 0.0, maxval::Float64 = 1.0)

Stretch the histogram of image to fill the range minval to maxval.

Inputs

-image: Image to be contrast stretched. -minval: Minimum value of pixels in image once stretched. -maxval: Maximum value of pixels in image once stretched.

source
SMLMData.contraststretchMethod
outimage = contraststretch(image::Matrix{Float64};
                        minval::Float64 = 0.0, maxval::Float64 = 1.0)

Stretch the histogram of image to fill the range minval to maxval.

Inputs

-image: Image to be contrast stretched. -minval: Minimum value of pixels in image once stretched. -maxval: Maximum value of pixels in image once stretched.

Outputs

-outimage: Contrast stretched copy of input image.

source
SMLMData.gaussimMethod
image = gaussim(smld::SMLMData.SMLD2D, pxsize::Float64, filename::String;
                pxsize_out::Float64 = 0.005,
                prctileceiling::Float64 = 99.5, 
                nsigma::Float64 = 5.0)

Generate and save a user-friendly (i.e., scaled and thresholded) Gaussian image.

Description

This method is a wrapper for makegaussim() which generates a more user-friendly Gaussian image. That is, this method calls makegaussim(), applies a percentile ceiling to the results, and then performs a contrast stretch so its pixels occupy the range [0.0, 1.0]. This method of gaussim() saves the image in the user-specified filename.

Inputs

-smld: SMLMData.SMLD2D data structure containing localizations. -pxsize: Pixel size of localizations in smld. (micrometers) -filename: String specifying the location of the output image. -pxsize_out: Desired output pixel size. (micrometers) -prctileceiling: Upper percentile used to threshold the pixel values of particularly bright pixels. -nsigma: Number of standard deviations from the localization coordinate at which we truncate the Gaussian. (Default = 5.0)

source
SMLMData.gaussimMethod
image = gaussim(smld::SMLMData.SMLD2D, pxsize::Float64;
                pxsize_out::Float64 = 0.005,
                prctileceiling::Float64 = 99.5, 
                nsigma::Float64 = 5.0)

Generate a user-friendly (i.e., scaled and thresholded) Gaussian image.

Description

This method is a wrapper for makegaussim() which generates a more user-friendly Gaussian image. That is, this method calls makegaussim(), applies a percentile ceiling to the results, and then performs a contrast stretch so its pixels occupy the range [0.0, 1.0].

Inputs

-smld: SMLMData.SMLD2D data structure containing localizations. -pxsize: Pixel size of localizations in smld. (micrometers) -pxsize_out: Desired output pixel size. (micrometers) -prctileceiling: Upper percentile used to threshold the pixel values of particularly bright pixels. -nsigma: Number of standard deviations from the localization coordinate at which we truncate the Gaussian. (Default = 5.0)

source
SMLMData.isolateROIMethod
smld_sub = isolateROI(smld::SMLD, roi::Vector{<:Real})

Isolate the smld localizations specified by the roi region of interest.

Description

This method grabs the localizations from smld that fall within roi.

Inputs

  • smld: SMLMData.SMLD structure populated with localizations.
  • roi: Region of interest containing desired localizations. Must use the same units as smld.x and smld.y, with the pixel convention that pixel coordinates exist in the range [-0.5, 0.5]. (for SMLD2D: [YStart; XStart; YEnd; XEnd] for SMLD3D: [YStart; XStart; ZStart; YEnd; XEnd; ZEnd])
source
SMLMData.isolateconnectedMethod
smld_connected, keepbool = isolateconnected(smld::SMLMData.SMLD)

Prepare individual SMLD structures for each precluster in smld.

Description

Connected localizations in smld (based on their connectID field) are reorganized into distinct SMLD structures, with each structure corresponding to a single connectID.

Inputs

-smld: SMLD structure containing the localization data, with the field connectID populated with a meaningful set of connection indices.

outputs

-smld_connected: Vector of SMLD structures with each structure containing localizations that share the same connectID. -keepbool: Vector of BitVector defining the smld indices sharing the same connectID.

source
SMLMData.isolatesmldMethod

smld_sub = isolatesmld(smld::SMLD, keepbit::BitVector)

Isolate the smld localizations specified by keepbit BitVector.

Description

This method grabs the localizations requested by the BitVector keepbit, which should have the same length as the number of localizations in smld.

source
SMLMData.isolatesmldMethod
smld_sub = isolatesmld(smld::SMLD, subind::Int)

Isolate the smld localizations specified by subind index.

Description

This method grabs the localization indexed by subind from smld and outputs a new SMLD structure containing only those localization.

source
SMLMData.isolatesmldMethod
smld_sub = isolatesmld(smld::SMLD, subind::UnitRange)

Isolate the smld localizations specified by subind indices.

Description

This method grabs the localizations indexed by subind from smld and outputs a new SMLD structure containing only those localization.

source
SMLMData.isolatesmldMethod
smld_sub = isolatesmld(smld::SMLD, subind::Vector{Int})

Isolate the smld localizations specified by subind indices.

Description

This method grabs the localization indexed by subind from smld and outputs a new SMLD structure containing only those localization.

source
SMLMData.makebinimFunction
image = makebinim(smld::SMLMData.SMLD2D, mag::Float64 = 20.0)

Make a binary image of the localizations in smld.

Description

This function creates an image of the localizations in smld by placing a hot pixel at the coordinates of each localization.

Inputs

-smld: SMLMData.SMLD2D data structure containing localizations. -mag: Approximate magnfication from data coordinates to SR coordinates. (Default = 20.0)

Outputs

-image: Matrix{Float64} binary image of localizations.

source
SMLMData.makebinimFunction
image = makebinim(coords::Matrix{Float64}, 
                  datasize::Vector{Float64},
                  mag::Float64 = 20.0)

Make a binary image of the localizations in coords.

Description

This function creates an image of the localizations in coords by placing a hot pixel at the coordinates of each localization.

Inputs

-coords: Localization coordinates. ([y x]) -datasize: Size of the data image. ([ysize xsize]) -mag: Approximate magnfication from data coordinates to SR coordinates. (Default = 20.0)

Outputs

-image: Matrix{Float64} binary image of localizations.

source
SMLMData.makecircleimFunction
image = makecircleim(smld::SMLMData.SMLD2D, mag::Float64 = 20.0)

Make a circle image of the localizations in smld.

Description

This function creates an image of the localizations in smld by adding a circle for each localization.

Inputs

-smld: SMLMData.SMLD2D data structure containing localizations. -mag: Approximate magnfication from data coordinates to SR coordinates. (Default = 20.0)

Outputs

-image: Matrix{Float64} circle image of localizations.

source
SMLMData.makecircleimFunction
image = makecircleim(coords::Matrix{Float64},
                     σ::Vector{Flsoat64},
                     datasize::Vector{Int},
                     mag::Float64 = 20.0)

Make a circle image of the localizations in coords.

Description

This function creates an image of the localizations in coords by adding a circle centered at the locations coords with radii σ.

Inputs

-coords: Localization coordinates. ([y x]) -σ: Standard error of localizations in coords. (nlocx1) -datasize: Size of the data image. ([ysize xsize]) -mag: Approximate magnfication from data coordinates to SR coordinates. (Default = 20.0)

Outputs

-image: Matrix{Float64} histogram image of localizations.

source
SMLMData.makegaussimMethod
image = makegaussim(μ::Matrix{Float64},
                    σ_μ::Matrix{Float64}, 
                    datasize::Vector{Int};
                    mag::Float64 = 20.0, 
                    nsigma::Float64 = 5.0)

Make a Gaussian image of the localizations in μ.

Description

This function creates an image of the localizations defined by μ and σ_μ in which Gaussians with standard deviations σ_μ are added at positions μ.

Inputs

-μ: Positions of the Gaussians. (pixels)([y x]) -σ_μ: Standard errors of μ estimates. (pixels)([y x]) -datasize: Size of the region of data collection. (pixels)([y; x]) -mag: Approximate magnfication from data coordinates to SR coordinates. (Default = 20.0) -nsigma: Number of standard deviations from the localization coordinate at which we truncate the Gaussian. (Default = 5.0)

Outputs

-image: Matrix{Float64} Gaussian image in which each localization in smld is plotted as a Gaussian.

source
SMLMData.makegaussimMethod
image = makegaussim(smld::SMLMData.SMLD2D;
                    mag::Float64 = 20.0, 
                    nsigma::Float64 = 5.0)

Make a Gaussian image of the localizations in smld.

Description

This function creates an image of the localizations in smld by placing a Gaussian truncated to nsigma at the localization coordinates, where the standard deviation is given by smld.σ_x and smld.σ_y. The image is then normalized such that it sums to 1.0. The background signal is not accounted for in this method.

Inputs

-smld: SMLMData.SMLD2D data structure containing localizations. -mag: Approximate magnfication from data coordinates to SR coordinates. (Default = 20.0) -nsigma: Number of standard deviations from the localization coordinate at which we truncate the Gaussian. (Default = 5.0)

Outputs

-image: Matrix{Float64} Gaussian image in which each localization in smld is plotted as a Gaussian.

source
SMLMData.makehistimFunction
image = makehistim(smld::SMLMData.SMLD2D, mag::Float64 = 20.0)

Make a histogram image of the localizations in smld.

Description

This function creates an image of the localizations in smld by adding 1.0 to a pixel for each localization present within that pixel. The final image is then scaled so that it sums to 1.0.

Inputs

-smld: SMLMData.SMLD2D data structure containing localizations. -mag: Approximate magnfication from data coordinates to SR coordinates. (Default = 20.0)

Outputs

-image: Matrix{Float64} histogram image of localizations.

source
SMLMData.makehistimFunction
image = makehistim(coords::Matrix{Float64},
                   datasize::Vector{Int},
                   mag::Float64 = 20.0)

Make a histogram image of the localizations in coords.

Description

This function creates an image of the localizations in coords by adding 1.0 to a pixel for each localization present within that pixel. The final image is then scaled so that it sums to 1.0.

Inputs

-coords: Localization coordinates. ([y x]) -datasize: Size of the data image. ([ysize xsize]) -mag: Approximate magnfication from data coordinates to SR coordinates. (Default = 20.0)

Outputs

-image: Matrix{Float64} histogram image of localizations.

source