View source: R/computeFeatures.R
computeFeatures | R Documentation |
Computes morphological and texture features from image objects.
computeFeatures(x, ref, methods.noref=c("computeFeatures.moment", "computeFeatures.shape"),
methods.ref=c("computeFeatures.basic", "computeFeatures.moment", "computeFeatures.haralick"),
xname="x", refnames, properties=FALSE, expandRef=standardExpandRef, ...)
computeFeatures.basic(x, ref, properties=FALSE, basic.quantiles=c(0.01, 0.05, 0.5, 0.95, 0.99), xs, ...)
computeFeatures.shape(x, properties=FALSE, xs, ...)
computeFeatures.moment(x, ref, properties=FALSE, xs, ...)
computeFeatures.haralick(x, ref , properties=FALSE, haralick.nbins=32, haralick.scales=c(1, 2), xs, ...)
standardExpandRef(ref, refnames, filter = gblob())
x |
An |
ref |
A matrix or a list of matrices, containing the intensity values of the reference objects. |
methods.noref |
A character vector containing the function names
to be called to compute features without reference intensities. Default is
|
methods.ref |
A character vector containing the function names
to be called to compute features with reference intensities. Default is
|
xname |
A character string naming the object layer. Default is
|
refnames |
A character vector naming the reference intensity
layers. Default are the names of |
properties |
A logical. If |
expandRef |
A function used to expand the reference
images. Default is |
basic.quantiles |
A numerical vector indicating the quantiles to compute. |
haralick.nbins |
An integer indicating the number of bins using to compute the Haralick matrix. See Details. |
haralick.scales |
A integer vector indicating the number of scales to use to compute the Haralick features. |
xs |
An optional temporary object created by
|
filter |
The filter applied to reference images using |
... |
Optional arguments passed to the feature computation functions. |
Features are named x.y.f, where x is the object layer, y the reference
image layer and f the feature name. Examples include cell.dna.mean
,
indicating mean DNA intensity computed in the cell or
nucleus.tubulin.cx
, indicating the x center of mass of tubulin
computed in the nucleus region.
The function computeFeatures
computes sets of
features. Features are organized in 4 sets, each computed by a
different function. The function computeFeatures.basic
computes spatial-independent statistics on pixel intensities:
b.mean: mean intensity
b.sd: standard deviation intensity
b.mad: mad intensity
b.q*: quantile intensity
The function computeFeatures.shape
computes features that
quantify object shape:
s.area: area size (in pixels)
s.perimeter: perimeter (in pixels)
s.radius.mean: mean radius (in pixels)
s.radius.sd: standard deviation of the mean radius (in pixels)
s.radius.max: max radius (in pixels)
s.radius.min: min radius (in pixels)
The function computeFeatures.moment
computes features
related to object image moments, which can be computed with or without
reference intensities:
m.cx: center of mass x (in pixels)
m.cy: center of mass y (in pixels)
m.majoraxis: elliptical fit major axis (in pixels)
m.eccentricity: elliptical eccentricity defined by sqrt(1-minoraxis^2/majoraxis^2). Circle eccentricity is 0 and straight line eccentricity is 1.
m.theta: object angle (in radians)
The function computeFeatures.haralick
computes features
that quantify pixel texture. Features are named according to
Haralick's original paper.
If properties
if FALSE
(by default), computeFeatures
returns a matrix of n cells times p features, where p depends of
the options given to the function. Returns NULL
if no object is
present.
If properties
if TRUE
, computeFeatures
returns a matrix of p features times 2 properties (translation and
rotation invariance). Feature properties are useful to filter out
features that may not be needed for specific tasks, e.g. cell
position when doing cell classification.
Gregoire Pau, gregoire.pau@embl.de, 2011
R. M. Haralick, K Shanmugam and Its'Hak Deinstein (1979). Textural Features for Image Classification. IEEE Transactions on Systems, Man and Cybernetics.
bwlabel
, propagate
## load and segment nucleus
y = readImage(system.file("images", "nuclei.tif", package="EBImage"))[,,1]
x = thresh(y, 10, 10, 0.05)
x = opening(x, makeBrush(5, shape='disc'))
x = bwlabel(x)
display(y, title="Cell nuclei")
display(x, title="Segmented nuclei")
## compute shape features
fts = computeFeatures.shape(x)
fts
## compute features
ft = computeFeatures(x, y, xname="nucleus")
cat("median features are:\n")
apply(ft, 2, median)
## compute feature properties
ftp = computeFeatures(x, y, properties=TRUE, xname="nucleus")
ftp
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.