Skip to contents

Find landmark locations for registration

Usage

tf_landmarks_extrema(x, which = "all", threshold = 0.5, boundary_tol = NULL)

Arguments

x

a tf vector.

which

character: which features to detect. Either "all" (maxima, minima, and zero crossings), "both" (maxima and minima), or any subset of c("max", "min", "zero").

threshold

numeric in (0, 1]: minimum proportion of curves that must contain a feature for it to be retained as a landmark. Defaults to 0.5.

boundary_tol

numeric: features within this distance of the domain boundary are dropped (they are redundant with the boundary anchors in landmark registration). Defaults to 2x the grid spacing. Set to 0 to keep all features.

Value

A numeric matrix with one row per function and one column per landmark, sorted left-to-right on the domain. Has attribute "feature_types" (character vector of "max", "min", or "zero" for each column). Contains NA where a curve is missing a landmark.

Details

Detects local maxima, minima, and/or zero crossings in each function and returns a landmark matrix suitable for tf_register() with method = "landmark". Uses position-based clustering across curves to establish feature correspondence and majority-count filtering to discard unstable landmarks.

See also

tf_register() with method = "landmark"

Other registration functions: tf_align(), tf_estimate_warps(), tf_register(), tf_register_shape(), tf_registration, tf_warp()

Examples

t <- seq(0, 1, length.out = 101)
x <- tfd(t(sapply(c(0.3, 0.5, 0.7), function(s) dnorm(t, s, 0.1))), arg = t)
tf_landmarks_extrema(x, "max")
#> Warning: No stable landmarks detected across curves.
#>  Pre-smoothing with `tf_smooth()` can help suppress spurious features.
#>     
#> [1,]
#> [2,]
#> [3,]
#> attr(,"feature_types")
#> character(0)
tf_landmarks_extrema(x, "both")
#> Warning: No stable landmarks detected across curves.
#>  Pre-smoothing with `tf_smooth()` can help suppress spurious features.
#>     
#> [1,]
#> [2,]
#> [3,]
#> attr(,"feature_types")
#> character(0)