View source: R/ifcb_extract_classified_images.R
| ifcb_extract_classified_images | R Documentation |
This function reads a classified sample file (.mat, .h5, or .csv) and
extracts specified taxa images from the corresponding ROI files,
saving each image in a specified directory. Supports .mat files generated
by start_classify_batch_user_training from the ifcb-analysis repository
(Sosik and Olson 2007), .h5 files in IFCB Dashboard class_scores format,
and .csv files in ClassiPyR-compatible format.
ifcb_extract_classified_images(
sample,
classified_folder,
roi_folder,
out_folder,
taxa = "All",
threshold = "opt",
overwrite = FALSE,
scale_bar_um = NULL,
scale_micron_factor = 1/3.4,
scale_bar_position = "bottomright",
scale_bar_color = "black",
old_adc = FALSE,
gamma = 1,
normalize = FALSE,
use_python = FALSE,
verbose = TRUE
)
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().
No return value, called for side effects. Extracts and saves taxa images to a directory.
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.
ifcb_extract_pngs ifcb_extract_annotated_images https://github.com/hsosik/ifcb-analysis
## Not run:
# Define the parameters
sample <- "D20230311T092911_IFCB135"
classified_folder <- "path/to/classified_folder"
roi_folder <- "path/to/roi_folder"
out_folder <- "path/to/outputdir"
taxa <- "All" # or specify a particular taxa
threshold <- "opt" # or specify another threshold
# Extract taxa images from the classified sample
ifcb_extract_classified_images(sample, classified_folder, roi_folder, out_folder, taxa, threshold)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.