getFeatures {EBImage}R Documentation

Feature extraction for objects in indexed images

Description

Functions to extract numerical descriptors for objects in indexed images. The functions here call a set of individual feature extraction routines for every feature set like hull, texture (Haralick), edge, moment features etc.

Usage


  ## S4 method for signature 'IndexedImage':
  getFeatures(x, ref, N=12, R=30, apply.Gaussian=TRUE, nc=256, ...)
  ## S4 method for signature 'IndexedImage':
  features(x, ...)

Arguments

x An object of IndexedImage (like those obtained from propagate or watershed.
ref A reference image containing images of the objects in Grayscale mode (intensity values)!
N Passed to zernikeMoments. Integer value defining the degree of the Zernike polynomials, which in turn defines the number of features calculated. Defaults to 12.
R Passed to zernikeMoments. Defines the radius of the circle around an object centre from which the features are calculated. It also defines the standard deviation for the 2D Gausian applied at the centre of an object. See details. Defaults to 30.
apply.Gaussian Passed to zernikeMoments. A logical value that specifies if a local 2D Gaussian modification should be applied to every object at its centre. Defaults to TRUE.
nc Passed to haralickFeatures. A numeric value. Specifies the number of gray levels to separate ref into when calculating the co-occurrence matrix. Here defaults to 256.
... Reserved.

Details

ref can be missing in calls to getFeatures. In this case texture and other intensity-dependent features will be omitted.

Value

getFeatures calculates feature matrices and returns an object of IndexedImage with its features slot set. The typical use would be to re-assign the result to the original image itself, i.e. x <- getFeatures(x, a).
features extracts the content of the features slot of the IndexedImage. If it is empty, the function calls getFeatures without a reference image and returns the generated feature set. In this case the features slot of the original image is not updated.

Author(s)

Oleg Sklyar, osklyar@ebi.ac.uk, 2007

See Also

IndexedImage, propagate, paintObjects, stackObjects, hullFeatures, haralickFeatures, moments, edgeFeatures, zernikeMoments

Examples


  ## load images
  f <- paste( system.file(package="EBImage"), "images/Gene1_G.tif", sep="/" )
  ii = readImage(f)
  ## normalize images
  ii = normalize(ii, separate=TRUE)
  ## segment
  mask = thresh(ii, 25, 25, 0.02)
  ## refine segmentation with morphology filters
  mk3 = morphKern(3)
  mk5 = morphKern(5)
  mask = dilate(erode(closing(mask, mk5), mk3), mk5)
  ## index objects with 'watershed'
  io = watershed( distmap(mask), 1.5, 1)
  ft = hullFeatures(io)
  mf = moments(io, ii)   ## need these for intensity and size
  for ( i in seq_along(ft) ) ft[[i]] = cbind(ft[[i]], mf[[i]])
  io = rmObjects(io, lapply(ft, function(x) 
         which(x[,"h.s"] < 150 | x[,"int"] < 50 | 0.3 * x[,"h.p"] < x[,"h.edge"] )
       ))
  io = getFeatures(io, ii)
  str( features(io) )
  

[Package EBImage version 2.6.0 Index]