getVal | R Documentation |
Extract a value through one of the computeFeatures
family of
functions using an object mask and reference image or a list of each.
getVal(mask, ref = NULL, val = "b.mean", FUN = NULL, simplify = TRUE, ...)
mask |
An object mask or list of objects masks with connected pixels having the same integer value. |
ref |
A fluorescent |
val |
A character string identifying the parameter
to return from the |
FUN |
A |
simplify |
If |
... |
additional parameters are passed to |
Objects identified in mask
will be projected onto ref
and quantified with the function specified in FUN
. The single
value specified by val
will be returned as a list if
simplify == FALSE
or as a single vector if simplify == TRUE
.
Common usages include getting the mean intensity from an object mask
and reference image or getting the area of objects from an object mask
as shown below. The code has been accelerated by a factor of 8
for getting the area by using the tabulate
function
rather than the computeFeatures.shape
function.
# To extract the mean intensity: mfi <- getVal(mask, ref) # uses default parameter "b.mean" # To extract object area, collapsed to a single vector: area <- getVal(mask, val = "area") # no need 'ref' # A complex example of Haralick difference entropy at # at a Haralick scale of 4 pixels den <- getVal(mask, ref, val = "h.den.s4", FUN = computeFeatures.haralick, haralick.scales = 4)
The character string in val
is used as a grep
pattern to
search among the parameters returned by the computeFeatures
functions. Consequently, a partial match such as "ecc" is sufficient
for a parameter such as "m.eccentricity". However, because "mean" occurs
in "b.mean" and "s.radius.mean", a partial match to "mean" does not
identify a unique parameter. The unique parameter is used to assign the
value to FUN
. This value can be explicitly assigned as one of
computeFeatures.basic
,
computeFeatures.shape
,
computeFeatures.moment
and
computeFeatures.haralick
.
See the EBImage
help page for appropriate values for
FUN
and val
but note that "basic quantiles
"
parameters are mislabeled with an extra '0
'. For example, the 5th
percentile and 95th percentile values are named "b.q005
"
and "b.q095
", respectively.
A vector if simplify
is TRUE
or a list of values obtained
from FUN
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.