API

API

Types

x = NumDenom(num, denom)

NumDenom{T} is an object containing a (num,denom) pair. x.num is num and x.denom is denom.

Algebraically, NumDenom objects act like 2-vectors, and can be added and multiplied by scalars:

nd1 + nd2 = NumDenom(nd1.num + nd2.num, nd1.denom + nd2.denom)
2*nd      = NumDenom(2*nd.num, 2*nd.denom)

Note that this is not what you'd get from normal arithmetic with ratios, where, e.g., 2*nd would be expected to produce NumDenom(2*nd.num, nd.denom). The reason for calling these * and + is for use in Interpolations.jl, because it allows interpolation to be performed on "both arrays" at once without recomputing the interpolation coefficients. See the documentation for information about how this is used for performing aperturered mismatch computations.

As a consequence, there is no convert(Float64, nd::NumDenom) method, because the algebra above breaks any pretense that NumDenom numbers are somehow equivalent to ratios. If you want to convert to a ratio, see ratio.

source

Functions related to NumDenom

index = indmin_mismatch(numdenom, thresh) returns the location of the minimum value of what is effectively num./denom. However, it considers only those points for which denom .> thresh; moreover, it will never choose an edge point. index is a CartesianIndex into the arrays.

source
RegisterCore.maxshiftFunction.
mxs = maxshift(D)

Return the maxshift value used to compute the mismatch array D.

source

mms = mismatcharrays(nums, denoms) packs array-of-arrays num/denom pairs as an array-of-MismatchArrays.

mms = mismatcharrays(nums, denom), for denom a single array, uses the same denom array for all nums.

source
RegisterCore.ratioFunction.
r = ratio(nd::NumDenom, thresh, fillval=NaN)

Return nd.num/nd.denom, unless nd.denom < thresh, in which case return fillval converted to the same type as the ratio. Choosing a thresh of zero will always return the ratio.

source
RegisterCore.separateFunction.

num, denom = separate(mm) splits an AbstractArray{NumDenom} into separate numerator and denominator arrays.

source

Utility functions

RegisterCore.highpassFunction.

datahp = highpass([T], data, sigma) returns a highpass-filtered version of data, with all negative values truncated at 0. The highpass is computed by subtracting a lowpass-filtered version of data, using Gaussian filtering of width sigma. As it is based on Image.jl's Gaussian filter, it gracefully handles NaN values.

If you do not wish to highpass-filter along a particular axis, put Inf into the corresponding slot in sigma.

You may optionally specify the element type of the result, which for Integer or FixedPoint inputs defaults to Float32.

source

pp = PreprocessSNF(bias, sigmalp, sigmahp) constructs an object that can be used to pre-process an image as pp(img). The "SNF" part of the name means "shot-noise filtered," meaning that this preprocessor is specifically designed for situations in which you are dominated by shot noise (i.e., from photon-counting statistics).

The processing is of the form

    imgout = bandpass(√max(0,img-bias))

i.e., the image is bias-subtracted, square-root transformed (to turn shot noise into constant variance), and then band-pass filtered using Gaussian filters of width sigmalp (for the low-pass) and sigmahp (for the high-pass). You can pass sigmalp=zeros(n) to skip low-pass filtering, and sigmahp=fill(Inf, n) to skip high-pass filtering.

source

Apad = paddedview(A), for a SubArray A, returns a SubArray that extends to the full parent along any non-sliced dimensions of the parent. See also trimmedview.

source

B = trimmedview(Bpad, A::SubArray) returns a SubArray B with axes(B) = axes(A). Bpad must have the same size as paddedview(A).

source