autoDetect: Automatic detection of tree-ring boundaries

Description Usage Arguments Details Value Note Author(s) References Examples

Description

This function is used to automatically detect tree-ring boundaries along the user-defined path.

Usage

1
2
3
4
5
6
7
autoDetect(ring.data, seg = 1, auto.path = TRUE, manual = FALSE, 
  method = "canny", incline = FALSE, sample.yr = NULL, 
  watershed.threshold = "auto", watershed.adjust = 0.8, 
  struc.ele1 = NULL, struc.ele2 = NULL, marker.correct = FALSE, 
  default.canny = TRUE, canny.t1, canny.t2, canny.smoothing = 2, 
  canny.adjust = 1.4, path.dis = 1, origin = 0, border.color = "black", 
  border.type = 16, label.color = "black", label.cex = 1.2)

Arguments

ring.data

A magick image object produced by imgInput.

seg

An integer specifying the number of image segments.

auto.path

A logical value. If TRUE, a path is automatically created at the center of the image. If FALSE, the function allows the user to create a sub-image and a path by interactive clickings. See details below.

manual

A logical value indicating whether to skip the automatic detection. If TRUE, ring boundaries are visually identified using the function visualSelect.

method

A character string specifying how ring borders are detected. It requires one of the following characters: "watershed", "canny", or "lineardetect". See details below.

incline

A logical value indicating whether to correct ring widths. If TRUE, two horizontal paths are added to the image.

sample.yr

NULL or an integer giving the year of formation of the left-most ring. If NULL, use the current year.

watershed.threshold

The threshold used for producing the marker image, either a numeric from 0 to 1, or the character "auto" (using the Otsu algorithm), or a character of the form "XX%" (e.g., "58%").

watershed.adjust

A numeric used to adjust the Otsu threshold. The default is 1 which means that the threshold will not be adjusted. The sizes of early-wood regions in the marker image will reduce along with the decrease of watershed.adjust.

struc.ele1

NULL or a vector of length two specifying the width and height of the first structuring element. If NULL, the size of the structuring element is determined by the argument dpi.

struc.ele2

NULL or a vector of length two specifying the width and height of the second structuring element. If NULL, the size of the structuring element is determined by the argument dpi.

marker.correct

A logical value indicating whether to relabel early-wood regions by comparing the values of their left-side neighbours.

default.canny

A logical value. If TRUE, upper and lower Canny thresholds are determined automatically.

canny.t1

A numeric giving the threshold for weak edges.

canny.t2

A numeric giving the threshold for strong edges.

canny.smoothing

An integer specifying the degree of smoothing.

canny.adjust

A numeric used as a sensitivity control factor for the Canny edge detector. The default is 1 which means that the sensitivity will not be adjusted. The number of detected borders will reduce along with the increase of this value.

path.dis

A numeric specifying the perpendicular distance between two paths when the argument incline = TRUE. The unit is in mm.

origin

A numeric specifying the origin in smoothed gray to find the ring borders. See ringBorders in the package measuRing.

border.color

Color for ring borders.

border.type

Symbol for ring borders. See pch in points for possible values and their shapes.

label.color

Color for years and border numbers.

label.cex

The magnification to be used for years and border numbers.

Details

If auto.path = FALSE, the user can create a user-defined rectangular sub-image and a horizontal path by interactively clicking on the tree-ring image. The automatic detection will be performed within the rectangular sub-image along a pre-determined path. To create the sub-image and the path, follow these steps.

After creating the sub-image and the path, this function will open several graphical windows and plot detected ring borders on image segments. The number of image segments is controlled by the argument seg (see above).

Argument method determines how ring borders are identified.

If the argument method = "watershed" or "canny", the original image is processed by morphological openings and closings using rectangular structuring elements of increasing size before detecting borders. The first small structuring element is used to remove smaller dark spots in early wood regions, and the second large structuring element is used to remove light strips in late wood regions. More details can be found at Soille and Misson (2001).

Value

A matrix (grayscale image) or array (color image) representing the tree-ring image.

Note

This function uses the function locator to record mouse positions so it only works on "X11", "windows" and "quartz".

Author(s)

Jingning Shi

References

Soille, P., Misson, L. (2001) Tree ring area measurements using morphological image analysis. Canadian Journal of Forest Research 31, 1074-1083. doi: 10.1139/cjfr-31-6-1074

Lara, W., Bravo, F., Sierra, C.A. (2015) measuRing: An R package to measure tree-ring widths from scanned images. Dendrochronologia 34, 43-50. doi: 10.1016/j.dendro.2015.04.002

Examples

1
2
3
4
5
6
7
8
9
img.path <- system.file("001.png", package = "MtreeRing")

## Read and plot the image:
t1 <- imgInput(img = img.path, dpi = 1200)

## Split a long core sample into 3 pieces to
## get better display performance and use the
## watershed algorithm to detect ring borders:
t2 <- autoDetect(t1, seg = 3, method = 'watershed', border.color = 'green')

JingningShi/GifRepo documentation built on May 14, 2019, 10:59 p.m.