stackObjects             package:EBImage             R Documentation

_P_l_a_c_e_s _d_e_t_e_c_t_e_d _o_b_j_e_c_t_s _i_n_t_o _a_n _i_m_a_g_e _s_t_a_c_k

_D_e_s_c_r_i_p_t_i_o_n:

     Places detected objects into an image stack.

_U_s_a_g_e:

       stackObjects(x, ref, index, combine=TRUE, rotate, bg.col='black', ext, centerby, rotateby)

_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.

 combine: If 'x' contains multiple images, specifies if the resulting
          list of image stacks with individual objects should be
          combined using 'combine' into a single image stack.

  bg.col: Background pixel color.

     ext: A numeric controlling the size of the output simage. If
          missing, 'ext' is estimated from data. See details.

index, rotate, centerby, rotateby: Deprecated.

_D_e_t_a_i_l_s:

     'stackObjects' creates a set of 'nbobj' images of size ('2*ext+1',
     '2*ext+1'), where 'nbobj' is the number of objects in 'x', and
     places each object of 'x' in this set.

     If not specified, 'ext' is estimated using the 95% quantile of
     2*sqrt('g.l1'), where 'g.l1' is the semi-major axis descriptor
     extracted from 'hullFeatures', taken over all the objects of the
     image 'x'.

_V_a_l_u_e:

     An 'Image' object containing the stacked objects contained in 'x'.
     If 'x' contains multiple images and if 'combine' is 'TRUE',
     'stackObjects' returns a list of 'Image' objects.

_A_u_t_h_o_r(_s):

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

_S_e_e _A_l_s_o:

     'combine', 'tile', 'hullFeatures'

_E_x_a_m_p_l_e_s:

       ## simple example
       x = readImage(system.file('images', 'shapes.png', package='EBImage'))
       x = x[110:512,1:130]
       y = bwlabel(x)
       if (interactive()) display(normalize(y), title='Objects')
       z = stackObjects(y, normalize(y))
       if (interactive()) display(z, title='Stacked objects')

       ## 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(bwlabel(nmask))

       ## segment cells, using propagate and nuclei as 'seeds'
       ctmask = opening(cel>0.1, makeBrush(5, shape='disc'))
       cmask = propagate(cel, nmask, ctmask)

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

       ## stacked cells
       st = stackObjects(cmask, img)
       if (interactive()) display(st, title='Stacked objects')

