vpr_autoid_read: Read VPR aid files

View source: R/EC_functions.R

vpr_autoid_readR Documentation

Read VPR aid files

Description

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

Usage

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

Arguments

file_list_aid

a list object of aid text files, containing roi strings. Output from matlab Visual Plankton software.

file_list_aidmeas

a list object of aidmea text files, containing ROI measurements. Output from matlab Visual Plankton software.

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

Details

Only outputs either ROI string information OR measurement data

Note

Full paths to each file should be specified

Author(s)

E. Chisholm & K. Sorochan

Examples


station_of_interest <- 'test'
dayhour <- c('d222.h03', 'd222.h04')

#' #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 taxa
aid_path <- paste0(auto_id_path, '/aid/')
# Path to mea for each taxa
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
  )

# 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
 )


vprr documentation built on July 12, 2022, 5:07 p.m.