gpnlreg: Registers two data sets using Gaussian process nonrigid...

Description Usage Arguments Details Value Examples

Description

This function registers using two data sets using the nonrigid registration method developed in . The two data sets are registered as follows: first, locally estimate transformation parameters using a Gaussian process rigid registration model developed in and implemented in the function gp.rigid.registration; then fit spatial model(s) to the local estimates using spatialProcess or fastTps; finally predict the transformation parameters using these models at the two dimensional observation locations in data2, the moving data set.

Usage

1
gpnlreg(pd1, pd2 = NULL, setup.pars, est.pars)

Arguments

pd1

either a character vector path pointing the a delimited file whose first three columns are 3d locations of data set 1, a data frame containing data set 1 with the former specifications, or a gpnl.obj

pd2

character vector path pointing the a delimited file whose first three columns are 3d locations of data set 2, or a data frame containing data set 2

setup.pars

a list containing components nxx, nyy, ovrlp, and sqz

est.pars

a list containing n.subsamples, smoothness, lambd, upper.bounds and lower.bounds, min.num.samples, and est.type

Details

Details: est.pars is a list containing n.subsamples (the number of subsamples to be taken from each data set in each window), smoothness (of the Matern covariance function in the local estimation procedure), lambd (value of tuning parameter in the penalty in the objective function, can be a vector of length four specifying a different multiplicative tuning parameter for each transformation parameter), penalty.type (one of 'L1', 'L2', 'elastic', or 'none'), upper.bounds and lower.bounds (box constraints in the local likelihood parameter estimation), min.num.samples (the minimum number of samples needed in both data sets to perform local estimation on a window of data), and est.type (a character vector 'serial' or 'Rmpi' indicating how the estimation should be performed).

The setup parameters list setup.pars includes the number of centroids in the grid in the x and y dimensions (nxx and nyy), an ovrlp parameter indicating how much each window overlaps (<0.5 indicates the windows are mutually exclusive, 0.5 indicates overlap only along the boundaries, and >0.5 indicates overlap among adjacent windows), and a sqz (or inset) parameter which insets the grid of centroids by (domainSize in one dimension)/sqz on each edge of the grid of centroids.

Value

a gpnl.obj with data.list, data.subsets, est.pars, setup.pars, est.results, and fit.results components

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
library(dplyr)
library(fields)
library(data.table)
data(largeCliffs)
d1 <- largeCliffs$data1
d2 <- largeCliffs$data2
setup.pars <- list(nxx=20, nyy=20, ovrlp=1.9, sqz=25)
trns.bwd <- 1
angl.bwd <- pi/4
est.pars <- list(n.subsamples=100,
                 smoothness=1,
                 lambd=20, # c(50,50,50,25)
                 penalty.type='L2',
                 lower.bounds=c(-Inf,-Inf,-Inf, -trns.bwd, -trns.bwd, -trns.bwd, -angl.bwd+0.1),
                 upper.bounds=c(4, Inf, Inf, trns.bwd, trns.bwd, trns.bwd, angl.bwd),
                 est.type='serial',
                 tps.lambda=0.1,
                 krig.theta=1) # 'serial', 'Rmpi', 'parallel'
gpnl.obj <- gpnlreg.setup(d1, d2, setup.pars)
gpnl.obj <- gpnlreg.estim.def(gpnl.obj, est.pars)
gpnl.obj <- gpnlreg(gpnl.obj, setup.pars=setup.pars, est.pars=est.pars)
## or all in one step:
gpnl.obj <- gpnlreg(d1, d2, setup.pars, est.pars)
## now plot for diagnostics
library(rgl)
plot.data.subset(gpnl.obj, 40)
plot.windows.i(gpnl.obj, c(40,41,42))
plot.param(gpnl.obj, 'x')
plot.param(gpnl.obj, 'y')
plot.param(gpnl.obj, 'z')
plot.param(gpnl.obj, 'phi')
plot.data(gpnl.obj$data.list$data1, 100, 100)
plot.data(gpnl.obj$data.list$data2, 100, 100, add=TRUE)
plot.data(gpnl.obj$data.list$data2.trf, 100, 100, add=TRUE)
plot.data.3d(gpnl.obj$data.list$data1)
plot.data.3d(gpnl.obj$data.list$data2, add=TRUE, col='blue')
plot.data.3d(gpnl.obj$data.list$data2.trf, add=TRUE, col='green')
quilt.plot(total.change[,1:2], abs(gpnl.obj$fit.results$trnsf.That[,1]))
quilt.plot(total.change[,1:2], abs(gpnl.obj$fit.results$trnsf.That[,2]))
quilt.plot(total.change[,1:2], abs(gpnl.obj$fit.results$trnsf.That[,3]))
quilt.plot(total.change[,1:2], abs(gpnl.obj$fit.results$trnsf.That[,4]))
rs <- apply(gpnl.obj$fit.results$trnsf.That, 1, function(x){sum(abs(x))})
total.change <- cbind(data2[,1:2], rs)
quilt.plot(total.change[,1:2], total.change[,3])

ashtonwiens/gp.nonrigid.registration documentation built on April 11, 2020, 12:28 a.m.