View source: R/ifcb_count_mat_annotations.R
ifcb_count_mat_annotations | R Documentation |
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.
ifcb_count_mat_annotations(
manual_files,
class2use_file,
skip_class = NULL,
sum_level = "class",
mat_recursive = FALSE,
use_python = FALSE
)
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 |
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()
.
A data frame with the total count of images per class, roi or per sample.
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.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.