Open ‘R’ function, and paste the following codes in the console (For more information about those codes, please see the Supplementary file, Appendix S2 of the published paper of Shi et al. (2015) (http://journal.frontiersin.org/article/10.3389/fpls.2015.00856/full):
wd <- c("I:/Biotool/Scripts/")
source (paste (wd, "simu.sf.R", sep=""))
source (paste (wd, "optim.sf.R", sep=""))
source (paste (wd, "fit.sf.R", sep=""))
source (paste (wed, "area.sf.R", sep=""))
data <- read.csv ("I:/Biotool/edge_data.csv", header=F)
x.provi <- data [,1]
y.provi <- data[,2]
x0.val <- 200
y0.val <- 200
theta.val <- pi/4
a.val <- 50
k.val <- 0.95
n.val <- 1.90
Phi <- seq(0, 2*pi, len=1000)
Para <- c (x0.val, y0.val, theta.val, a.val, k.val, n.val)
CV.val <- 0.01
res1 <- simu.sf(phi=Phi, par=Para, CV=CV.val, fig.opt = F)
x.simu <- res1$x
y.simu <- res1$y
x.width <- range(x.provi)[2] - range(x.provi)[1]
y.width <- range(y.provi)[2] - range(y.provi)[1]
a.ini <- max (y.width, x.width)/2
x0.ini <- (min(x.provi) + max(x.provi))/2
y0.ini <- (min(y.provi) + max(y.provi))/2
theta.ini <- pi/4
k.ini <- 0.95
n.ini <- 1.90
res2 <- optim.sf(x.provi, y.provi, x0.ini, y0.ini, theta.ini, a.ini, k.ini,
n.ini, fig.opt="F", para.list="F", convergence="Chi.square")
x0. range <- x0.ini
y0. range <- y0.ini
theta.range <- seq(0, pi/2, by=pi/8)
a.range <- a.ini
k.range <- seq(0.8, 1, by=0.1)
n.range <- seq(1.8, 2.2, by=0.1)
res3 <- fit.sf(x.provi, y.provi, x0=x0.range, y0=y0.range,
theta=theta.range, a=a.range, k=k.range, n=n.range,
para.list=F, fig.opt=F, convergence="Chi.square")
res4 <- fit.sf(x.provi, y.provi, res3$par[1], res3$par[2],
res3$par [3], res3$par [4], res3$par [5], res3$par [6],
para.list=T, fig.opt=T, convergence="Chi.square")
After the performing, it will finally generate a picture named ‘Data.fitting’ (Figure 11). The solid dark line represents the observed out contour of the two combined shoot apical meristems; the red solid line represents the predicted ring. The dark dashed line represents the direction of major axis; the blue dashed line represents the direction of x-axis. And their theta which indicates the angle value between the dark dashed line and the blue dashed line was calculated and displayed in R console (Figure 12).
Figure 11. The predicted image of the picture showed in Figure 7A
Figure 12. Parameters of the predicted image. The given parameters include the abscissa and ordinate of the pole (x0, y0) in the Cartesian system, the angle theta between the major axis and the x-axis, the major semi-axis a, the ratio k of the minor semi-axis (b) to the major semi-axis (a), the power n, the coefficient of determination (R.square), the χ2 (Chi.square) or the residual sum of squares (RSS).