paintObjects             package:EBImage             R Documentation

_M_a_r_k_s _o_b_j_e_c_t_s _i_n _i_m_a_g_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     This function marks objects in images.

_U_s_a_g_e:

       paintObjects(x, tgt, opac=c(1, 1), col=c('red', NA))

_A_r_g_u_m_e_n_t_s:

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

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

    opac: A numeric vector of two opacity values for drawing object
          boundaries and object bodies. Opacity ranges from 0 to 1,
          with 0 being fully transparent and 1 fully opaque.

     col: A character vector of two R colors for drawing object
          boundaries and object bodies. By default, object boundaries
          are painted in 'red' while object bodies are not painted.

_V_a_l_u_e:

     An 'Image' object or an array, containing the painted version of
     'tgt'.

_A_u_t_h_o_r(_s):

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

_S_e_e _A_l_s_o:

     'bwlabel', 'watershed', 'link{getFeatures}'

_E_x_a_m_p_l_e_s:

       ## load images
       nuc = readImage(system.file('images', 'nuclei.tif', package='EBImage'))
       cel = readImage(system.file('images', 'cells.tif', package='EBImage'))
       img = rgbImage(green=cel, blue=nuc)
       if (interactive()) display(img, title='Cells')

       ## segment nuclei
       nmask = thresh(nuc, 10, 10, 0.05)
       nmask = opening(nmask, makeBrush(5, shape='disc'))
       nmask = fillHull(nmask)
       nmask = bwlabel(nmask)
       if (interactive()) display(normalize(nmask), title='Cell nuclei mask')

       ## segment cells, using propagate and nuclei as 'seeds'
       ctmask = opening(cel>0.1, makeBrush(5, shape='disc'))
       cmask = propagate(cel, nmask, ctmask)
       if (interactive()) display(normalize(cmask), title='Cell mask')

       ## using paintObjects to highlight objects
       res = paintObjects(cmask, img, col='#ff00ff')
       res = paintObjects(nmask, res, col='#ffff00')
       if (interactive()) display(res, title='Segmented cells')

