paintObjects: Mark objects in images

Description Usage Arguments Value Author(s) See Also Examples

Description

Higlight objects in images by outlining and/or painting them.

Usage

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

Arguments

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.

thick

A logical indicating whether to use thick boundary contours. Default is FALSE.

closed

A logical indicating whether object contours should be closed along image edges or remain open.

Value

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

Author(s)

Oleg Sklyar, osklyar@ebi.ac.uk, 2006-2007 Andrzej Oles, andrzej.oles@embl.de, 2015

See Also

bwlabel, watershed, computeFeatures, colorLabels

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
  ## 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)
  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)
  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)
  display(normalize(cmask), title='Cell mask')

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

Example output

Only the first frame of the image stack is displayed.
To display all frames use 'all = TRUE'.
Only the first frame of the image stack is displayed.
To display all frames use 'all = TRUE'.
Only the first frame of the image stack is displayed.
To display all frames use 'all = TRUE'.
Only the first frame of the image stack is displayed.
To display all frames use 'all = TRUE'.
Warning message:
system call failed: Cannot allocate memory 

EBImage documentation built on Nov. 8, 2020, 5:41 p.m.