Curve Alignment¶
These functions are for processing of ND curves using the squareroot velocity framework (srvf)
SRVF Functions¶

curve_to_q
(beta)¶ Convert curve to squareroot velocity function (srvf)
beta
is an array of shape (n,T) describing the curve, where n is the dimension and T is the number of sample points

q_to_curve
(q)¶ Convert srvf to curve
q
is an array of shape (n,T) describing the srvf, where n is the dimension and T is the number of sample points

optimum_reparam
(beta1, beta2, lam, method="DP", w=0.01, rotated=true, isclosed=false))¶ Calculates the optimum reparamertization (warping) between two curves beta1 and beta2, using the srvf framework
beta1
array (n,T) describing curve 1beta2
array (n,T) describing curve 2lam
control amount of warping (default=0.0)method
optimization method to find warping, default is Dynamic Programming (“DP”). Other options are Coordinate Descent (“DP2”), Riemanain BFGS (“LRBFGS”).w
Controls LRBFGS (default = 0.01)rotated
calculate rotation (default = true)isclosed
closed curve (default = false)
Returns:
gam
warping functionR
rotation matrixtau
seed value

calc_shape_dist
(beta1, beta2)¶ Calculate elastic shape distance between two curves beta1 and beta2
beta1
andbeta2
are arrays of shape (n,T) describing the curve, where n is the dimension and T is the number of sample points

resamplecurve
(x, N=100)¶ Resmaples Curve
x
array describing curve (n,T)N
Number of samples to resample curve, N usually is > T
Alignment and Statistics¶

curve_pair_align
(beta1::Array{Float64, 2}, beta2::Array{Float64, 2})¶ Pairwise align two curves
beta1
array (n,T)beta2
array (n,T)
Returns:
beta2n
aligned curve 2 to 1q2n
aligned srvf 2 to 1gam
warping functionq1
srvf of curve 1

curve_geodesic
(beta1::Array{Float64, 2}, beta2::Array{Float64, 2}, k::Integer=5)¶ Find curves along geodesic between two curves
beta1
array (n,T)beta2
array (n,T)k
number of curves along geodesic
Returns:
geod
curves along geodesic (n,T,k)geod_q
srvf’s along geodesic

curve_srvf_align
(beta; mode='O', maxit=20)¶ Aligns a collection of curves using the elastic squareroot velocity (srvf) framework.
beta
array (n,T,N) for N number of curvesmode
Open (‘O’) or Closed (‘C’) curvesmaxit
maximum number of iterations
Returns:
betan
aligned curvesqn
aligned srvfsbetamean
mean curveq_mu
mean srvf

curve_karcher_mean
(beta; mode='O', maxit=20)¶ Calculates Karcher mean of a collection of curves using the elastic squareroot velocity (srvf) framework.
beta
array (n,T,N) for N number of curvesmode
Open (‘O’) or Closed (‘C’) curvesmaxit
maximum number of iterations
Returns:
mu
mean srvfbetamean
mean curvev
shooting vectorsq
array of srvfs

curve_karcher_cov
(betamean, beta; mode='O')¶ Calculate Karcher Covariance of a set of curves
betamean
array (n,T) of mean curvebeta
array (n,T,N) for N number of curvesmode
Open (‘O’) or Closed (‘C’) curves
Returns:
K
covariance matrix

curve_principal_directions
(betamean, mu, K; mode='O', no=3, N=5)¶ Calculate principal directions of a set of curves
betamean
array (n,T) of mean curvemu
array (n,T) of mean srvfK
array (T,T) covariance matrixmode
Open (‘O’) or Closed (‘C’) curveno
number of componentsN
number of samples on each side of mean
Returns:
pd
array describing principal directions

sample_shapes
(mu, K; mode='O', no=3, numSamp=10)¶ Sample shapes from model
mu
array (n,T) mean srvfK
array (T,T) covariance matrixmode
Open (‘O’) or Closed (‘C’) curvesno
number of principal componentsnumSamp
number of samples
Return:
samples
array (n,T,numSamp) of sample curves