ringDetect {measuRing}R Documentation

Single Detection of TRWs

Description

This function assists in the detection of TRW (mm) in a scanned image (.tif or .png) or gray matrix, evaluating other required functions and plotting the outputs in graphics devices. The function can be combined with ringSelect to visually detected TRWs. Nevertheless, the complete measurement procedure of TRW with the package can be performed by multiDetect.

Usage

ringDetect(image, ...)

Arguments

image

character or matrix. Vector of path to the image section or a gray matrix such as that produced by imageTogray.

...

arguments to be passed to other functions, see section of Details.

Details

The scanned sample should correspond to a horizontal window of wood with the bark side located towards the left area of the image, and the pit side towards the right. The image section may not necessarily contain both bark and pit, see images of the Examples. The image should contain Red, Gren, and Blue channels (rgb) and be compressed in any of two file formats: tif or png. These are easily obtained by scanning wood samples with a conventional scanner and extracting a horizontal image section. Five functions are internally implemented: plotSegments, dataSegments, ringWidths, ringBorders, and/orimageTogray. These are controlled using the following arguments:

If users run R from Interactive Development Environments (IDE) aiming to segment the image section (segs > 1), they should be sure that such environments support multiple graphics devices. If the argument image is a gray matrix, then other arguments passed to imageTogray will be ignored. The function can be combined with ringSelect to visually include/exclude ring borders in the plot output, see examples in the ringSelect function. See multiDetect for recursive implementation of this function.

references<<

Value

list of data frames with ring widths and ring borders such as these produced by ringWidths, and ringBorders.

Author(s)

Wilson Lara, Carlos Sierra, Felipe Bravo

Examples

image1 <- system.file("P105_a.tif", package="measuRing")
## (not run) Initial diagnostic:
detect1 <- ringDetect(image1,segs=3)
## (not run) Updating ringDetect to chage arguments;
## and flagged rings
detect1 <- update(detect1,marker=8) 
## (not run) Some noise in smoothed gray can be avoided
## by moving the origin: 
detect1 <- update(detect1,origin = -0.03)
## (not run) columns 21 and 130 are not considered now.
##
## (not run) Choose other columns in gray matrix (see ringSelect);
## (not run) graphical devices from ringDetect should be active!
## (not run) Including columns:
## (uncomment and run):
## detect1 <- update(detect1)
## Toinc <- ringSelect(detect1)
## detect1 <- update(detect1, inclu = Toinc)
## or, include the next columns: 
Toinc <- c(202,387,1564) 
detect1 <- update(detect1,inclu = Toinc)        
## (not run) Object detec1 is updated with Toinc;
##
## (not run)  ring borders to be excluded:
## (uncomment and run):
## detect1 <- update(detect1)
## Toexc <- ringSelect(detect1,any.col = FALSE)
## detect1 <- update(detect1,exclu=Toexc)
## or, exclude the nex columns: 
Toexc <- c(208,1444,1484)
detect1 <- update(detect1,exclu = Toexc)        
##
## (not run) Final arguments:
detect2 <- update(detect1,last.yr=2011,marker = 8)
str(detect2)
##
## (not run) kill previous plot:
graphics.off()
##
## (not run) Tree-ring widths and attributes:
rings <- detect2$'ringWidths'
##
## (not run) Plot of the tree-ring witdths:        
maint <- 'Hello ring widths!'
plot(rings,ylab = 'width (mm)',type='l',col = 'red',main=maint)

[Package measuRing version 0.5 Index]