Skip to contents

If a mask is present, a subset of the surface matrix is extracted based on specified value(s).

Usage

x3p_extract(x3p, mask_vals)

Arguments

x3p

x3p object

mask_vals

vector of mask value(s)

Value

x3p object

Examples

logo <- x3p_read(system.file("csafe-logo.x3p", package="x3ptools"))
# add a mask
logo <- x3p_add_mask(logo)
mask <- t(logo$surface.matrix==median(logo$surface.matrix))
logo <- x3p_add_mask_layer(logo, mask, color = "red", annotation = "median") 
x3p_extract(logo, "#cd7f32") 
#> x3p object
#> Instrument: N/A 
#> Model: N/A 
#> Date: 2018-01-30T08:30:24 
#> size (width x height): 741 x 419 in pixel 
#> resolution: 6.4500e-07 x 6.4500e-07 
#> Creator: Heike Hofmann, CSAFE 
#> Comment: image rendered from the CSAFE logo 
# x3p_image(logo, size=c(500,500), zoom = 1)