VolumeRegistration

VolumeRegistration.apply_deformation_mapMethod
apply_deformation_map(moving, shifts, blocks; spline_type)

Corrects a sequence of imaging stacks with a transformation found through non-rigid registration

optionally, specify the spline_type for interpolations between found shifts other than linear

source
VolumeRegistration.calc_snrMethod

Computes the signal to noise ratio of a phase correlation array, defined as the ratio of the maximum phase correlation in the window divided by the maximal phase correlation outside of the region where the maximum is (the idea being that it will be low if the phase correlation is flat versus peaked)

source
VolumeRegistration.extract_low_frequenciesMethod

Takes the data corresponding to the real part of the corners of the phase correlation array of interest for shift finding

extract_low_frequencies(data, corner_size)
extract_low_frequencies(data, corner_size, interpolate_middle)

Arugments

source
VolumeRegistration.find_deformation_mapMethod

Find deformation maps by splitting the dataset in blocks and aligning blocks with subpixel precision

Arguments

  • moving: the stack to be registered
  • reference: the stack to be registered to
  • border_σ: how far to fade out the borders of the whole image/volume
  • block_size::NTuple{N, Integer}: size of blocks to compute deformations
  • block_border_σ::Union{Real, NTuple{N, Real}}: how far to fade out the
  • max_shift::Union{Real, NTuple{N, Integer}}: maximum displacement of a block in each dimension
  • σ_filter: low-pass filter width
  • upsampling: upsampling of the registration for subpixel alignment
  • upsample_padding: how far to pad from the local maximum for upsampling
  • snr_n_smooths::Integer=2: number of times the correlation matrices are smoothed by wieghting with adjacent ones (if they are under signal-to-noise ratio)
  • snr_threshold::Real: the threshold of the "peakiness" of the correlation matrix, if it's smaller than that, it's value is obtained by smoothing neighbors
  • snr_n_pad::Integer: window size of the signal-to-noise calculation
source
VolumeRegistration.find_translationMethod
find_translation(movings, reference; interpolate_middle, kwargs...)

Find the shift to move moving by to align with reference

Arguments

  • σ_filter: standard deviation of a lowpass filter applied before finding translation
  • max_shift::Union{Integer, Tuple}: the maximal shift in each dimension
  • border_σ: the width of the border kernel for a smooth faloff towards the edges
  • upsampling::Union{Integer, Tuple}=1: If bigger than 1, how much to upsample the shifts by (for subpixel registration)
  • upsample_padding::Union{Integer, Tuple}=nothing how much ± pixels to take around maximum to upsample
  • interpolate_middle::Bool: whether to interpolate the middle correlation pixel (to avoid static camera noise)
source
VolumeRegistration.make_planewise_referenceMethod
make_planewise_reference(stack; reference_kw...)

Make a plane-by-plane reference for 2-photon imaging data, by first finding a reference image for each plane, and then finding inter-plane shifts and correcting them. The keyword arguments are from make_reference

source
VolumeRegistration.make_referenceMethod
make_reference(stack; kwargs...)

Make a reference for a stack

Arguments

  • stack: the data to be aligned, time is assumed to be the list dimension
  • time_range::AbstractUnitRange=Colon(): the range of time to take the reference from
  • corr_win: size of the window around the middle of the stack to calculate the optimal reference
  • n_refine_from: how many frames to make the refined reference from
  • n_average: number of frames to average for a nice reference
  • n_iterations: how many times to recalculate the reference from the best correlated moved frames

more keyword arguments for find_translation can be supplied

source
VolumeRegistration.register_volumes!Method
register_volumes!(destination, dataset, reference; max_shift, σ_filter, border_σ, interpolate_middle, upsampling, upsample_padding, deform, max_shift_deform, σ_filter_deform, border_σ_deform, block_border_σ, block_size, upsampling_deform, snr_n_smooths, snr_threshold, interpolate_middle_deform, t_block_size, output_time_first, block_range, interpolation_deform)

Register volumes, by first finding a rigid translationa and then optionally applying piecewise affine shifts.

Arguments

  • destination: the destination for the registered dataset, usually a Float32 subtype of a DiskArray
  • dataset: the stack to be registered
  • reference: the static volume regerence
  • deform: whether to additionally perform non-rigid registration
  • output_time_first: whether to reorder the array to have time-first or time-last order

The arguments are from find_translation for the pure translation, and from find_deformation_map for the piecewise affine transfomration (with the suffix _deform).

source
VolumeRegistration.split_into_blocksMethod

Splits data into an array of blocks, augmenting the last blocks which may not be full to keep consistent size. Cast immediately into complex for further processing

source
VolumeRegistration.translateMethod

Translate an image by known shift using either reindexing (for integer shifts) of FFT-based phase-space translation for non-integer shifts.

source