getFeatures             package:EBImage             R Documentation

_E_x_t_r_a_c_t _f_e_a_t_u_r_e _e_x_t_r_a_c_t_i_o_n _f_r_o_m _i_m_a_g_e _o_b_j_e_c_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     Extracts numerical features from image objects.

_U_s_a_g_e:

       getFeatures(x, ref, N=12, R=30, apply.Gaussian, nc=32, pseudo)

_A_r_g_u_m_e_n_t_s:

       x: An 'Image' object or an array containing object masks. Object
          masks are sets of pixels with the same unique integer value.

     ref: An 'Image' object or an array, containing the intensity
          values of the objects.

       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.  See details. Defaults to 30.

      nc: Passed to 'haralickFeatures'. A numeric value.  Specifies the
          number of gray levels to bin 'ref' into when  computing the
          co-occurrence matrix. Defaults to 32.

apply.Gaussian, pseudo: Deprecated.

_D_e_t_a_i_l_s:

     Combines and returns the features returned by 'hullFeatures',
     'moments', 'edgeFeatures', 'haralickFeatures' and
     'zernikeMoments'.

_V_a_l_u_e:

     'getFeatures' returns feature matrices.

_A_u_t_h_o_r(_s):

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

_S_e_e _A_l_s_o:

     'hullFeatures', 'moments', 'edgeFeatures' 'haralickFeatures',
     'zernikeMoments'

_E_x_a_m_p_l_e_s:

       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')

