read.tps: Reads 3D Coordinates from a TPS File

Description Usage Arguments Details Value See Also Examples

View source: R/utils.R

Description

Reads landmark coordinates stored in a TPS file as generated by save.tps.
Note: this is not a generic function to read TPS file, it's only designed for TPS file storing 3D landmark data. For more generic function, see e.g.: readland.tps, import_tps or readallTPS.

Usage

1
2
read.tps(file.name, sdir = getwd(), LMheader = "LM3",
         IDheader = "ID", SCheader = "SCALE", k = 3, quiet = FALSE)

Arguments

file.name

A character value containing the TPS file name (with extension).

sdir

A character value indicating the path to the saving directory.
Default: getwd().

LMheader

A character value specifying the keyword to use in the TPS file to indicate the number of landmarks.
Default: "LM3", for 3D landmarks.

IDheader

A character value specifying the keyword to use in the TPS file to indicate the individual identifier.
Default: "ID".

SCheader

A character value specifying the keyword to use in the TPS file to indicate the scale identifier.
Default: "SC".

k

A numercial value (positive integer) indicating the dimensions of data.
Default: 3.

quiet

A logical value indicating if a line should be printed when the tps file is opened (see scan).

Details

Given a TPS filename (file.name) contained in the sdir directory, this functions extracts 3D landmark coordinates (possibly scales them), and stores them into an array (landmarks by lines, dimensions=3 by columns, and individual by slices).

Value

A p*k*n numerical array (p: nb of landmarks, k: nb of dimensions, n: number of individuals).

See Also

save.tps.

Examples

1
2
3
4
5
6
7
8
9
# Generates first two 10*3 random matrices, just for illustration purpose,
# but such as it could be obtained after two mesh digitizations:
M <- matrix(rnorm(30), 10, 3)
N <- matrix(rnorm(30), 10, 3)
# Then, saves them as a TPS file:
save.tps(M, ID = "randomMatrix_M", file.name = "TPSfile4randomMatrix.tps")
save.tps(N, ID = "randomMatrix_N", file.name = "TPSfile4randomMatrix.tps", app=TRUE)
# And finally, read it:
A <- read.tps("TPSfile4randomMatrix.tps")

morphOptics/digit3DLand documentation built on July 17, 2021, 8:27 p.m.