collapse_spec {OpenSpecy} | R Documentation |
Define features
Description
Functions for analyzing features, like particles, fragments, or fibers, in
spectral map oriented OpenSpecy
object.
Usage
collapse_spec(x, ...)
## Default S3 method:
collapse_spec(x, ...)
## S3 method for class 'OpenSpecy'
collapse_spec(x, ...)
def_features(x, ...)
## Default S3 method:
def_features(x, ...)
## S3 method for class 'OpenSpecy'
def_features(x, features, shape_kernel = c(3, 3), ...)
Arguments
x |
an |
features |
a logical vector or character vector describing which of the
spectra are of features ( |
shape_kernel |
the width and height of the area in pixels to search for connecting features, c(3,3) is typically used but larger numbers will smooth connections between particles more. |
... |
additional arguments passed to subfunctions. |
Details
def_features()
accepts an OpenSpecy
object and a logical or
character vector describing which pixels correspond to particles.
collapse_spec()
takes an OpenSpecy
object with particle-specific
metadata (from def_features()
) and collapses the spectra to median
intensities for each unique particle.
It also updates the metadata with centroid coordinates, while preserving the
feature information on area and Feret max.
Value
An OpenSpecy
object appended with metadata about the features or
collapsed for the features.
Author(s)
Win Cowger, Zacharias Steinmetz
Examples
tiny_map <- read_extdata("CA_tiny_map.zip") |> read_any()
identified_map <- def_features(tiny_map, tiny_map$metadata$x == 0)
collapse_spec(identified_map)