fit_xform: Fit affine or thin plate spline transform to arbitrary...

View source: R/fit-xform.R

fit_xformR Documentation

Fit affine or thin plate spline transform to arbitrary transformation

Description

Fit affine or thin plate spline transform to arbitrary transformation

Usage

fit_xform(
  reg,
  samplepts,
  refpts = NULL,
  type = c("affine", "rigid", "similarity", "tps"),
  subsample = FALSE,
  scale = c(1, 1),
  ...
)

Arguments

reg

Any registration compatible with nat::xform, including non-rigid and multi-step registrations. You must either supply this or the refpts argument.

samplepts

A set of points in the sample (floating) space. Can be any object compatible with nat::xyzmatrix.

refpts

An optional set of points in the target (fixed) space matching samplepts. You must either supply this or the reg argument.

type

A character string specifying the type of registration. See Morpho::computeTransform for details.

subsample

A number of points to subsample from samplepts,refpts. The default value of FALSE means use all provided points to calculate the new transform.

scale

a 2-vector indicating the amount to scale the sample and reference points. You can supply one vector if this is the same. If the transform expects points in microns and returns points in microns then you would need scale=c(1000,1) if you want the input to be in microns and the output to be in nm.

...

Additional arguments passed to Morpho::computeTransform

Details

NB this function relies on installation of the suggested package Morpho.

Value

A homogeneous affine matrix or a nat::tpsreg object n.b. only in development nat (>= 1.10.1)

Examples

## Not run: 
library(nat.flybrains)
reg=shortest_bridging_seq(sample='FCWB', reference="JFRC2")
fit_xform(reg, nat::kcs20, subsample=200, type='affine')
# compute transform with translations in nm not microns
fit_xform(reg, nat::kcs20, subsample=200, type='affine', scale=1000)

## End(Not run)

jefferislab/nat.templatebrains documentation built on Aug. 21, 2023, 11:22 a.m.