This function reads an IFCB (.roi) file and its corresponding .adc file, extracts regions of interest (ROIs), and saves each ROI as a PNG image in a specified directory. Optionally, you can specify ROI numbers to extract, useful for specific ROIs from manual or automatic classification results.
Usage
ifcb_extract_pngs(
roi_file,
out_folder = dirname(roi_file),
ROInumbers = NULL,
taxaname = NULL,
verbose = TRUE,
overwrite = FALSE
)
Arguments
- roi_file
A character string specifying the path to the .roi file.
- out_folder
A character string specifying the directory where the PNG images will be saved. Defaults to the directory of the ROI file.
- ROInumbers
An optional numeric vector specifying the ROI numbers to extract. If NULL, all ROIs with valid dimensions are extracted.
- taxaname
An optional character string specifying the taxa name for organizing images into subdirectories. Defaults to NULL.
- verbose
A logical value indicating whether to print progress messages. Default is TRUE.
- overwrite
A logical value indicating whether to overwrite existing PNG files. Default is FALSE.
See also
ifcb_extract_classified_images
for extracting ROIs from automatic classification.
ifcb_extract_annotated_images
for extracting ROIs from manual annotation.
Examples
if (FALSE) { # \dontrun{
# Convert ROI file to PNG images
ifcb_extract_pngs("path/to/your_roi_file.roi")
# Extract specific ROI numbers from ROI file
ifcb_extract_pngs("path/to/your_roi_file.roi", "output_directory", ROInumbers = c(1, 2, 3))
} # }