\HeaderA{getFeatures}{Extract feature extraction from image objects}{getFeatures}
\keyword{manip}{getFeatures}
\begin{Description}\relax
Extracts numerical features from image objects.
\end{Description}
\begin{Usage}
\begin{verbatim}
  getFeatures(x, ref, N=12, R=30, apply.Gaussian, nc=32, pseudo)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] An \code{Image} object or an array containing object masks.
Object masks are sets of pixels with the same unique integer value.
\item[\code{ref}] An \code{Image} object or an array, containing the
intensity values of the objects.
\item[\code{N}] Passed to \code{\LinkA{zernikeMoments}{zernikeMoments}}. Integer value 
defining the degree of the Zernike polynomials, which in turn
defines the number of features calculated. Defaults to 12.
\item[\code{R}] Passed to \code{\LinkA{zernikeMoments}{zernikeMoments}}. Defines the radius 
of the circle around an object centre from which the features are calculated. 
See details. Defaults to 30.
\item[\code{nc}] Passed to \code{\LinkA{haralickFeatures}{haralickFeatures}}. A numeric value. 
Specifies the number of gray levels to bin \code{ref} into when 
computing the co-occurrence matrix. Defaults to 32.
\item[\code{apply.Gaussian, pseudo}] Deprecated.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Combines and returns the features returned by \code{hullFeatures},
\code{moments}, \code{edgeFeatures}, \code{haralickFeatures} and
\code{zernikeMoments}.
\end{Details}
\begin{Value}
\code{getFeatures} returns feature matrices.
\end{Value}
\begin{Author}\relax
Oleg Sklyar, \email{osklyar@ebi.ac.uk}, 2007
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{hullFeatures}{hullFeatures}}, \code{\LinkA{moments}{moments}}, \code{\LinkA{edgeFeatures}{edgeFeatures}}
\code{\LinkA{haralickFeatures}{haralickFeatures}}, \code{\LinkA{zernikeMoments}{zernikeMoments}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
  x = readImage(system.file('images', 'nuclei.tif', package='EBImage'))
  x = x[,,1]
  if (interactive()) display(x)

  ## computes object mask
  y = thresh(x, 10, 10, 0.05)
  y = opening(y, makeBrush(5, shape='disc'))
  mask = bwlabel(y)
  if (interactive()) display(mask, title='Cell nuclei')

  ## features
  ftrs = getFeatures(mask, x)[[1]]
  print(ftrs[1:5,])

  ## paint nuclei with an eccentricity higher than 0.85
  maskb = mask
  id = which(ftrs[,'m.ecc']<0.85)
  maskb[!is.na(match(maskb, id))] = 0

  img = paintObjects(maskb, channel(x, 'rgb'), col='red')
  if (interactive()) display(img, title='Nuclei with high eccentricity')
\end{ExampleCode}
\end{Examples}

