Learn R Programming

x3ptools (version 0.0.4)

x3p_select: Draw rectangle on the mask of an x3p file using rgl

Description

Interactive selection of rectangular area on the mask of an x3p object. Once the function runs, the active rgl window is brought to the front. Select the window with a click, then use click & drag to select a rectangular area. On release, this area is marked in the mask and (if update is TRUE) appears in the selection color in the active rgl window.

Usage

x3p_select(x3p, col = "#FF0000", update = TRUE)

Value

x3p file with selection in mask

Arguments

x3p

x3p file

col

character value of the selection color

update

boolean value, whether the rgl window should be updated to show the selected rectangle

Examples

Run this code
if (FALSE) {
if (interactive) {
  if (!file.exists("fadul1-1.x3p")) {
    url <- "https://tsapps.nist.gov/NRBTD/Studies/CartridgeMeasurement/DownloadMeasurement"
    file <- "2d9cc51f-6f66-40a0-973a-a9292dbee36d"
    download.file(file.path(url, file), destfile="fadul1-1.x3p")
  }
  x3p <- x3p_read("fadul1-1.x3p")
  x3p_image(x3p, size=c(500,500), zoom=.8)
  x3p <- x3p_select(x3p, update=TRUE, col="#FF0000") 

  logo <- x3p_read(system.file("csafe-logo.x3p", package="x3ptools"))
  x3p_image(logo, size=c(500,500), zoom = 1)
  x3p_select(logo, update=TRUE, col="#00FF00") 
}}

Run the code above in your browser using DataLab