ring_modify: Edit ring borders visually

Description Usage Arguments Details Value Author(s) Examples

View source: R/ring_modify.R

Description

This function can remove existing ring borders or add new borders.

Usage

1
2
ring_modify(ring.data, del = NULL, del.u = NULL, del.l = NULL,
  add = FALSE)

Arguments

ring.data

A matrix or array produced by ring_detect.

del

A numeric vector giving the border numbers to be removed.

del.u

A numeric vector giving the border numbers to be removed on the upper path.

del.l

A numeric vector giving the border numbers to be removed on the lower path.

add

A logical value indicating whether to add new ring borders.

Details

This function is used to remove existing ring borders, or to add new borders by interactively clicking on the image segments.

If the user creates one path (incline = FALSE), the argument del is used to remove ring borders. If the user creates two paths (incline = TRUE), arguments del.u and del.l are used to remove ring borders.

If add = TRUE, graphics windows opened by ring_detect will be activated sequentially. When a graphics window is activated, the user can add new borders by left-clicking the mouse along the path. Every click draws a point representing the ring border. Type vignette('detection-MtreeRing') to see an example of adding ring borders.

The identification process does not automatically stop by itself.

Once the user terminates the identification process, the current graphics window will be closed automatically, and the graphics window of the following segment is activated. When all graphics windows are closed, ring_modify will re-open graphics windows and plot new borders.

This function can perform both deletion and addition in one call. The removal of ring borders takes precedence over addition.

Value

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

Author(s)

Jingning Shi

Examples

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

## Read a tree ring image:
t1 <- ring_read(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 <- ring_detect(ring.data = t1, seg = 3, method = 'watershed')

## Do not modify t2, but create a new array object t3. 
## Remove some borders without adding new borders:
t3 <- ring_modify(ring.data = t2, del = c(1, 3, 5, 19:21), add = FALSE)

JingningShi/MtreeRing documentation built on Dec. 10, 2019, 9:37 a.m.