Skip to contents

The Deformetrica 4 estimate path: fit a diffeomorphism that deforms source (the moving template) onto target (the fixed subject). With ordered source <-> target row correspondences a point-to-point Landmark attachment is used. Returns the estimated control points + momenta, which deformetrica_shoot() then applies to arbitrary new points.

Usage

deformetrica_register(
  source,
  target,
  kernel_width,
  timepoints = 10L,
  object_type = "Landmark",
  attachment_type = c("Landmark", "Varifold", "Current"),
  noise_std = 0.01,
  max_iterations = 150L,
  device = c("auto", "cpu", "cuda"),
  deformetrica = NULL,
  workdir = tempfile("dfca_reg_"),
  verbose = FALSE
)

Arguments

source, target

N x 3 matrices of corresponding points (row i of source matches row i of target). Must have the same number of rows.

kernel_width

Deformation kernel width (larger = stiffer / more global). This also sets the CONTROL-POINT count: Deformetrica seeds control points on a grid spaced by kernel_width over the objects' bounding box, so CP count grows as (extent / kernel_width)^3. It is the knob for how many control points the warp has. Beware a value that is small relative to the object EXTENT (e.g. a compact arbor with a long soma tract): it spawns thousands of control points, over-parameterises the fit, and the optimiser can collapse to zero momenta (identity warp). Size kernel_width to the extent (for a sane CP count) and use the per-object object_kernel_width to set the finer matching scale.

timepoints

Geodesic integration steps.

object_type

Deformetrica deformable-object-type (default "Landmark").

attachment_type

"Landmark" (ordered L2, default), "Varifold" or "Current".

noise_std

Data-attachment noise standard deviation.

max_iterations

Optimiser iterations.

device

kernel-device: "auto", "cpu" or "cuda".

deformetrica

Optional path to the executable (auto-detected otherwise).

workdir

Working directory for the run (a fresh tempdir by default).

verbose

Show deformetrica output.

Value

A deformetricareg object (a portable handle on the fitted diffeomorphism, storing the control points + momenta inline). Apply it with nat::xform(x, reg) or deformetrica_shoot(); it survives saveRDS(). Its elements control_points, momenta, kernel_width, timepoints and output_dir are still accessible.