Read aid text files containing ROI string information or measurement data and output as a dataframe

vpr_autoid_read(
  file_list_aid,
  file_list_aidmeas,
  export,
  station_of_interest,
  opticalSetting,
  warn = TRUE,
  categories
)

Arguments

file_list_aid

a list object of aid text files, containing ROI strings.

file_list_aidmeas

a list object of aidmea text files, containing ROI measurements.

export

a character string specifying which type of data to output, either 'aid' (roi strings) or 'aidmeas' (measurement data)

station_of_interest

Station information to be added to ROI data output, use NA if irrelevant

opticalSetting

Optional argument specifying VPR optical setting. If provided will be used to convert size data into mm from pixels, if missing size data will be output in pixels

warn

Logical, FALSE silences size data unit warnings

categories

A list object (of chr strings) with all the potential classification categories

Details

Only outputs either ROI string information OR measurement data

Note

Full paths to each file should be specified

Author

E. Chisholm & K. Sorochan

Examples


station_of_interest <- 'test'
dayhour <- c('d222.h03', 'd222.h04')
categories <- c("bad_image_blurry", "bad_image_malfunction",
"bad_image_strobe", "Calanus", "chaetognaths","ctenophores","krill",
"marine_snow","Other","small_copepod", "stick")

#' #VPR OPTICAL SETTING (S0, S1, S2 OR S3)
opticalSetting <- "S2"
imageVolume <- 83663 #mm^3

auto_id_folder <- system.file('extdata/COR2019002/autoid/', package = 'vprr', mustWork = TRUE)
auto_id_path <- list.files(paste0(auto_id_folder, "/"), full.names = TRUE)

#'   # Path to aid for each category
aid_path <- paste0(auto_id_path, '/aid/')
# Path to mea for each category
aidmea_path <- paste0(auto_id_path, '/aidmea/')

# AUTO ID FILES
aid_file_list <- list()
aidmea_file_list <- list()
for (i in 1:length(dayhour)) {
  aid_file_list[[i]] <-
    list.files(aid_path, pattern = dayhour[[i]], full.names = TRUE)
  # SIZE DATA FILES
  aidmea_file_list[[i]] <-
    list.files(aidmea_path, pattern = dayhour[[i]], full.names = TRUE)
}

aid_file_list_all <- unlist(aid_file_list)
aidmea_file_list_all <- unlist(aidmea_file_list)

 # ROIs
roi_dat_combine <-
  vpr_autoid_read(
    file_list_aid = aid_file_list_all,
    file_list_aidmeas = aidmea_file_list_all,
    export = 'aid',
    station_of_interest = station_of_interest,
    opticalSetting = opticalSetting,
    warn = FALSE,
    categories = categories
  )

# MEASUREMENTS
roimeas_dat_combine <-
  vpr_autoid_read(
    file_list_aid = aid_file_list_all,
    file_list_aidmeas = aidmea_file_list_all,
    export = 'aidmeas',
    station_of_interest = station_of_interest,
    opticalSetting = opticalSetting,
    warn = FALSE,
    categories = categories
 )