Learn R Programming

Morpho (version 2.12)

checkLM: Visually browse through a sample rendering its landmarks and corresponding surfaces.

Description

Browse through a sample rendering its landmarks and corresponding surfaces. This is handy e.g. to check if the landmark projection using placePatch was successful, and to mark specific specimen.

Usage

checkLM(
  dat.array,
  path = NULL,
  prefix = "",
  suffix = ".ply",
  col = "white",
  pt.size = NULL,
  alpha = 1,
  begin = 1,
  render = c("w", "s"),
  point = c("s", "p"),
  add = FALSE,
  meshlist = NULL,
  Rdata = FALSE,
  atlas = NULL,
  text.lm = FALSE
)

Value

returns an invisible vector of indices of marked specimen.

Arguments

dat.array

array or list containing landmark coordinates.

path

optional character: path to files where surface meshes are stored locally. If not specified only landmarks are displayed.

prefix

prefix to attach to the filenames extracted from dimnames(dat.array)[[3]] (in case of an array), or names(dat.array) (in case of a list)

suffix

suffix to attach to the filenames extracted from dimnames(dat.array)[[3]] (in case of an array), or names(dat.array) (in case of a list)

col

mesh color

pt.size

size of plotted points/spheres. If point="s". pt.size defines the radius of the spheres. If point="p" it sets the variable size used in point3d.

alpha

value between 0 and 1. Sets transparency of mesh 1=opaque 0= fully transparent.

begin

integer: select a specimen to start with.

render

if render="w", a wireframe will be drawn, else the meshes will be shaded.

point

how to render landmarks. "s"=spheres, "p"=points.

add

logical: add to existing rgl window.

meshlist

list holding meshes in the same order as dat.array (Overrides path).

Rdata

logical: if the meshes are previously stored as Rdata-files by calling save(), these are simply loaded and rendered. Otherwise it is assumed that the meshes are stored in standard file formats such as PLY, STL or OBJ, that are then imported with the function file2mesh.

atlas

provide object generated by createAtlas to specify coloring of surface patches, curves and landmarks

text.lm

logical: number landmarks. Only applicable when atlas=NULL.

See Also

placePatch, createAtlas, plotAtlas, file2mesh

Examples

Run this code

data(nose)
###create mesh for longnose
longnose.mesh <- tps3d(shortnose.mesh,shortnose.lm,longnose.lm,threads=1)
### write meshes to disk
save(shortnose.mesh, file="shortnose")
save(longnose.mesh, file="longnose")

## create landmark array
data <- bindArr(shortnose.lm, longnose.lm, along=3)
dimnames(data)[[3]] <- c("shortnose", "longnose")
if (FALSE) {
checkLM(data, path="./",Rdata=TRUE, suffix="")
}

## now visualize by using an atlas:
atlas <- createAtlas(shortnose.mesh, landmarks =
           shortnose.lm[c(1:5,20:21),],
patch=shortnose.lm[-c(1:5,20:21),])
if (interactive()){
checkLM(data, path="./",Rdata=TRUE, suffix="", atlas=atlas)
}
## remove data from disk
unlink("shortnose")
unlink("longnose")

Run the code above in your browser using DataLab