ifcb_count_mat_annotations {iRfcb} | R Documentation |
Count IFCB Annotations from .mat Files
Description
This function processes .mat
files, generated by the code in the ifcb-analysis
repository (Sosik and Olson 2007),
to count and summarize the annotations for each class based on the class2use information provided in a file.
Usage
ifcb_count_mat_annotations(
manual_files,
class2use_file,
skip_class = NULL,
sum_level = "class",
mat_recursive = FALSE,
use_python = FALSE
)
Arguments
manual_files |
A character string specifying the path to the .mat files or a folder containing .mat files. |
class2use_file |
A character string specifying the path to the file containing the class2use variable. |
skip_class |
A numeric vector of class IDs or a character vector of class names to be excluded from the count. Default is NULL. |
sum_level |
A character string specifying the level of summarization. Options: "sample", "roi" or "class" (default). |
mat_recursive |
Logical. If TRUE, the function will search for MATLAB files recursively when |
use_python |
Logical. If |
Details
If use_python = TRUE
, the function tries to read the .mat
file using ifcb_read_mat()
, which relies on SciPy
.
This approach may be faster than the default approach using R.matlab::readMat()
, especially for large .mat
files.
To enable this functionality, ensure Python is properly configured with the required dependencies.
You can initialize the Python environment and install necessary packages using ifcb_py_install()
.
If use_python = FALSE
or if SciPy
is not available, the function falls back to using R.matlab::readMat()
.
Value
A data frame with the total count of images per class, roi or per sample.
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
## Not run:
# Count annotations excluding specific class IDs
result <- ifcb_count_mat_annotations("path/to/manual_folder",
"path/to/class2use_file",
skip_class = c(99, 100))
print(result)
# Count annotations excluding a specific class name
result <- ifcb_count_mat_annotations("path/to/manual_folder",
"path/to/class2use_file",
skip_class = "unclassified")
print(result)
## End(Not run)