Correct Annotations in MATLAB Classlist Files
Source:R/ifcb_correct_annotation.R
ifcb_correct_annotation.Rd
This function corrects annotations in MATLAB classlist files located in a specified manual folder,
generated by the code in the ifcb-analysis
repository (Sosik and Olson 2007).
It replaces the class ID of specified regions of interest (ROIs) in the classlist files based on
a correction file or a character vector.
Usage
ifcb_correct_annotation(
manual_folder,
out_folder,
correction = NULL,
correct_classid,
do_compression = TRUE,
correction_file = deprecated()
)
Arguments
- manual_folder
A character string specifying the path to the folder containing the original MAT classlist files to be updated.
- out_folder
A character string specifying the path to the folder where updated MAT classlist files will be saved.
- correction
Either a character string specifying the path to the correction file, or a character vector containing image filenames to be corrected. If a file is provided, it should have a column named
image_filename
. If a character vector is provided, it will be treated as a direct list of image filenames.- correct_classid
An integer specifying the class ID to use for corrections.
- do_compression
A logical value indicating whether to compress the .mat file. Default is TRUE.
- correction_file
Value
This function does not return any value; it updates the classlist files in the specified output directory.
Details
This function requires a python interpreter to be installed. The required python packages can be installed in a virtual environment using ifcb_py_install
.
The correction file is expected to contain at least one column: image_filename
, which includes the filenames of the images (with or without additional trailing information).
The function processes each file, corrects the annotations, and saves the updated files in the output folder.
If a character vector is provided as correction
, it will be used directly as a list of filenames for correction.
The correction
is typically generated using a Shiny app that provides an interactive interface for browsing and managing
IFCB (Imaging FlowCytobot) image galleries. This Shiny app can be initialized using the function ifcb_run_image_gallery()
.
References
Sosik, H. M. and Olson, R. J. (2007), Automated taxonomic classification of phytoplankton sampled with imaging-in-flow cytometry. Limnol. Oceanogr: Methods 5, 204–216.
Examples
if (FALSE) { # \dontrun{
# Initialize a python session if not already set up
ifcb_py_install()
# Correct class ID in .mat classlist files using a correction file
ifcb_correct_annotation("input/manual",
"output/manual",
"corrections.txt",
99)
# Correct class ID in .mat classlist files using a character vector of filenames
ifcb_correct_annotation("input/manual",
"output/manual",
c("D20230917T153755_IFCB134_01724.png",
"D20230917T110059_IFCB134_00380.png"),
99)
} # }