Library
MicroscopePSFs.Airy2D
MicroscopePSFs.Dipole3D
MicroscopePSFs.Gauss2D
MicroscopePSFs.Gauss2D
MicroscopePSFs.ImmPSF
MicroscopePSFs.InterpolatedPSF
MicroscopePSFs.PSF
MicroscopePSFs.PupilFunction
MicroscopePSFs.Scalar3D
MicroscopePSFs.SplinePSF
MicroscopePSFs.ZernikeCoefficients
MicroscopePSFs.calEfield
MicroscopePSFs.calFresnel
MicroscopePSFs.importpsf
MicroscopePSFs.load
MicroscopePSFs.makeobs
MicroscopePSFs.nl2noll
MicroscopePSFs.nl2osa
MicroscopePSFs.noll2nl
MicroscopePSFs.noll2osa
MicroscopePSFs.normalize!
MicroscopePSFs.osa2nl
MicroscopePSFs.osa2noll
MicroscopePSFs.pdf
MicroscopePSFs.pdf
MicroscopePSFs.pdf
MicroscopePSFs.pdf!
MicroscopePSFs.pdfₐ
MicroscopePSFs.pdfₐ
MicroscopePSFs.pdfₐ!
MicroscopePSFs.radialpolynomial
MicroscopePSFs.save
MicroscopePSFs.zernikepolynomial
MicroscopePSFs.zernikepolynomial
MicroscopePSFs.Airy2D
— TypeAiry PSF
2D Airy Patter psf using paraxial, scalar model
Fields
na
: Numerical Apertureλ
: Emission Wavelengthpixelsize
: Linear size of a back-projected pixel
The Airy PSF is I(r)=ν²/(4π)(2J₁(νr)/(νr))² where ν=πD/(λf)=2π*nₐ/λ
MicroscopePSFs.Dipole3D
— TypeDipole3D
3D psf using vector model and OTF rescaling
Fields
pupilfunctionx
: Pupil Function defines the x component of the electric fieldpupilfunctiony
: Pupil Function defines the y component of the electric fieldpixelsize
: Linear size of a back-projected pixel, unit: micron- 'Σ' : OTF rescaling via image space 2D Gaussian Covariance matrix
- 'dipole_ang' : orientation of dipole moment (polar, azimuthal)
- 'ksize' : number of pixels in pupil
- 'electricfield' : electric field component, 'x' or 'y'
- 'normf' : normalization factor
Constructor
Dipole3D(nₐ, λ, n, pixelsize, dipole_ang; Σ=0, ksize=256, z::ZernikeCoefficients=ZernikeCoefficients(1))
- 'nₐ' : numerical aperture
- 'λ' : emission wavelength, unit is micrion
- 'n' : refractive indices (sample medium, cover glass, immersion medium)
MicroscopePSFs.Gauss2D
— TypeGauss2D
Isotropic 2D Gaussian psf
Fields
σ
: Gaussian σpixelsize
: Linear size of a pixel
MicroscopePSFs.Gauss2D
— MethodGauss2D(p::Airy2D)
convert an Airy2D to Gaussian PSF
MicroscopePSFs.ImmPSF
— TypeImmPSF
3D psf with index mismatch aberration using scalar or vector model and OTF rescaling
Fields
pupilfunction
: Pupil Function structurepixelsize
: Linear size of a back-projected pixel, unit: micron- 'Σ' : OTF rescaling via image space 2D Gaussian Covariance matrix
- 'ksize' : number of pixels in pupil
Constructor
ImmPSF(nₐ, λ, n, pixelsize; inputpupil=nothing, Σ=0, ksize=256, z::ZernikeCoefficients=ZernikeCoefficients(1))
- 'nₐ' : numerical aperture
- 'λ' : emission wavelength, unit is micrion
- 'n' : refractive indices of (sample medium, coverglass, immersion medium)
- 'zstage' : position of the sample stage, unit: micron
- 'inputpupil' : input pupil function, default is nothing
- 'mvtype' : type of motion, the z position is changed by moving 'bead' or 'stage'
MicroscopePSFs.InterpolatedPSF
— TypeInterpolatedPSF(p,r;subsampling=4)
3D psf interpolated from other PSF models (linear interpolation)
Fields
p
: Generator PSFr
: range (x,y,z) where x,y,z are maximum supported range in each dimensionsubsampling
: subsampling (default = 4)itp
: linear interpolation object for intensity PSFitp_real
: linear interpolation object for real part of the amplitude PSFitp_imag
: linear interpolation object for imaginary part of the amplitude PSFpixelsize
: Linear size of a back-projected pixel
Constructor
InterpolatedPSF(p,r;subsampling=4)
MicroscopePSFs.PSF
— TypePSF
defines an abstract type
MicroscopePSFs.PupilFunction
— TypePupilFunction
A structure defines the pupil function.
Fields
nₐ
: Numerical Apertureλ
: Emission Wavelengthn
: Immersion Indexpixelsize
: Linear size of a back-projected pixel- 'kpixelsize' : Number of pixels used in pupil function image
- 'pupil' : Pupil function with a dimension of (ksize, ksize, 2), including the amplitude and phase
Calculations of various 3D PSF types will involve calculations based around Pupil Funciton. They differ in the complexity and approach used to calculate Pupil Function.
MicroscopePSFs.Scalar3D
— TypeScalar3D
3D psf using scalar model and OTF rescaling
Fields
pupilfunction
: Pupil Function structurepixelsize
: Linear size of a back-projected pixel- 'Σ' : OTF rescaling via image space 2D Gaussian Covariance matrix
- 'ksize' : number of pixels in pupil
Constructor
Scalar3D(nₐ, λ, n, pixelsize; inputpupil=nothing, Σ=0, ksize=256, z::ZernikeCoefficients=ZernikeCoefficients(1))
- 'nₐ' : numerical aperture
- 'λ' : emission wavelength, unit is micrion
- 'n' : refractive indices of immersion medium
- 'inputpupil' : input pupil function, default is nothing
MicroscopePSFs.SplinePSF
— TypeSplinePSF
3D psf interpolated from a 3D PSF stack (spline interpolation)
Fields
psfstack
: a 3D PSF stacksitp
: spline interpolation objectpixelsize
: Linear size of a back-projected pixelpixelsize_z
: step size in z, unit: micron
Constructor
SplinePSF(psfstack;pixelsize_z=0.05,pixelsize=0.1)
MicroscopePSFs.ZernikeCoefficients
— TypeZernikeCoefficients
A mutable struct to hold the Zernike coefficients
Fields
mag
: Zernike coefficients of pupil mangnitudephase
: Zernike coefficients of pupil phase
Constructor
ZernikeCoefficients(n::Int)
n
: number of Zernike coefficients
MicroscopePSFs.calEfield
— MethodcalEfield(ϕ, Tp, Ts, sinθ₁, cosθ₁; dvec = [1,1,1])
Calculate electric field of a given dipole orientation
Arguments
ϕ
: azimuthal coordinate of the electric fieldTp
: Fresnel coefficient for p-polarizationTs
: Fresnel coefficient for s-polarizationsinθ₁
: sine of the incident angle in the sample mediumcosθ₁
: cosine of the incident angle in the sample mediumdvec
: dipole moment vector
Returns
- x component of the electric field
- y component of the electric field
- A vector of six components of the electric field from dipole radiation
MicroscopePSFs.calFresnel
— MethodcalFresnel(kr2,λ,n::Vector)
Calculate Fresnel coefficients
Arguments
kr2
: magnitude square of the radial component of the k vectorλ
: emission wavelength, unit is micrionn
: refractive indices (sample medium, cover glass, immersion medium)
Returns
Tp
: Fresnel coefficient for p-polarizationTs
: Fresnel coefficient for s-polarizationsinθ₁
: sine of the incident angle in the sample mediumcosθ₁
: cosine of the incident angle in the sample mediumcosθ₂
: cosine of the incident angle in the cover glasscosθ₃
: cosine of the incident angle in the immersion medium
MicroscopePSFs.importpsf
— Methodimportpsf(filename, psftype; zstage=0.0, source="python", mvtype="bead")
import PSF data from PSF learning software
Arguments
filename
: file name of the PSF datapsftype
: PSF types that are supported by julia package, options are: "scalar3D", "immPSF", "splinePSF"source
: software that generates the PSF data, default is "python"zstage
: position of the sample stage, equal to zero at the coverslip, positive when imaging inside the samplemvtype
: for immPSF only, options are: "bead", "stage"
returns
p
: PSF TypePSFstack
: a 3D stack of learned PSFz
: ZernikeCoefficients Typeh
: PupilFunction Type
Example:
p, PSFstack, z, h = importpsf(filename,psftype)
MicroscopePSFs.load
— Methodload(psffile::String)
load PSF file
Arguments
psffile
: The full path to the psf file
Return
The MicroscopePSFs type from the file
MicroscopePSFs.makeobs
— Methodmakeobs(r)
make a set of observations points in a square window
Arguments
r
: A range
returns a vector of Tuples e.g. (x,y)
Example:
obs=makeobs(-8:8)
MicroscopePSFs.nl2noll
— Methodnl2noll(n::Int,l::Int)
convert the n
and l
indexes into a Noll linear index
Arguments
n
: radial indexl
: azimuthal index
Returns
j
: Noll linear index
MicroscopePSFs.nl2osa
— Methodnl2osa(n::Int,l::Int)
convert the n
and l
indexes into a OSE linear index
Arguments
n
: radial indexl
: azimuthal index
Returns
OSA linear index
MicroscopePSFs.noll2nl
— Methodnoll2nl(j::Int)
convert the Noll index j
into n
and l
Arguments
j
: Noll linear index
Returns
n
: radial indexl
: azimuthal index
MicroscopePSFs.noll2osa
— Methodnoll2osa(j::Int)
convert the Noll index j
to OSA index j
Arguments
j
: Noll linear index
Returns
OSA linear index
MicroscopePSFs.normalize!
— Methodnormalize!(p::PupilFunction)
normalize pupil using Parseval's theorem
MicroscopePSFs.osa2nl
— Methodosa2nl(j::Int)
convert the OSA index j
into n
and l
Arguments
j
: OSA linear index
Returns
n
: radial indexl
: azimuthal index
MicroscopePSFs.osa2noll
— Methodosa2noll(j::Int)
convert the OSA index j
to Noll index j
Arguments
j
: OSA linear index
Returns
Noll linear index
MicroscopePSFs.pdf!
— Methodpdf!(im::Array,p::PSF,roi::Array,x_emitter::Tuple)
update im
to the psf at pixel locations defined by roi
with emitter located at x_emitter
.
Arguments
im::Array
: array of numerical values with the same size as roip::PSF
: psf structureroi::Array
: array of tuples that define the pixel locationsx_emitter::Tuple
: location of emitter
MicroscopePSFs.pdf
— Methodpdf(p::PSF,roi::Array,x_emitter::Array)
return the overlap of multiple psfs at pixel locations defined by roi
with emitter positions defined by x_emitter
.
Arguments
p::PSF
: psf structureroi::Array
: array of tuples that define the pixel locationsx_emitter::Array
: array of tuples that defines the emitter locations
MicroscopePSFs.pdf
— Methodpdf(p::PSF,roi::Array,x_emitter::Tuple)
return the psf at pixel locations defined by roi
with emitter located at x_emitter
.
Arguments
p::PSF
: psf structureroi::Array
: array of tuples that define the pixel locationsx_emitter::Tuple
: location of emitter
MicroscopePSFs.pdf
— Methodpdf(p::PSF,x_pixel::Tuple,x_emitter::Tuple)
abstract function: return the psf at pixel x_pixel
with emitter located at x_emitter
.
Arguments
p::PSF
: psf structurex_pixel::Tuple
: location of pixelx_emitter::Tuple
: location of emitter
MicroscopePSFs.pdfₐ!
— Methodpdfₐ!(im::Array,p::PSF,roi::Array,x_emitter::Tuple)
update im
to the complex amplitude at pixel locations defined by roi
with emitter located at x_emitter
.
Arguments
im::Array
: array of numerical values with the same size as roip::PSF
: psf structureroi::Array
: array of tuples that define the pixel locationsx_emitter::Tuple
: location of emitter
MicroscopePSFs.pdfₐ
— Methodpdfₐ(p::PSF,roi::Array,x_emitter::Tuple)
return the complex amplitude at pixel locations defined by roi
with emitter located at x_emitter
.
Arguments
p::PSF
: psf structureroi::Array
: array of tuples that define the pixel locationsx_emitter::Tuple
: location of emitter
MicroscopePSFs.pdfₐ
— Methodpdfₐ(p::PSF,x_pixel::Tuple,x_emitter::Tuple)
abstract function: return the complex amplitude at pixel x_pixel
with emitter located at x_emitter
.
Arguments
p::PSF
: psf structurex_pixel::Tuple
: location of pixelx_emitter::Tuple
: location of emitter
MicroscopePSFs.radialpolynomial
— Methodradialpolynomical(n::Int,m::Int,ρ)
return the value of the n,m
radial polynomial at ρ
values of ρ>1
will return zero
Arguments
n
: radial indexm
: azimuthal indexρ
: radial coordinate
Returns
r
: value of the radial polynomial atρ
MicroscopePSFs.save
— Methodsave(psffile::String,p::PSF)
save PSF type as .jld2 file
Arguments
psffile
: The full saving pathp
: MicroscopePSFs type
MicroscopePSFs.zernikepolynomial
— Methodzernike(j::Int,ρ,ϕ; linearindex="OSA")
return the value of jth zernike polynomial at ρ,ϕ
for a given Zernike linear index
Arguments
j
: Zernike linear indexρ
: radial coordinateϕ
: azimuthal coordinatelinearindex
: linear index type, either "OSA" or "Noll"
Returns
value of the zernike polynomial at ρ,ϕ
MicroscopePSFs.zernikepolynomial
— Methodzernike(n::Int,l::Int,ρ,ϕ)
return the value the n,l
zernike polynomial at ρ,ϕ
Note that l
is in -n<:2:n
.
Arguments
n
: radial indexl
: azimuthal indexρ
: radial coordinateϕ
: azimuthal coordinate
Returns
value of the zernike polynomial at ρ,ϕ