Extracts a data.frame in which each row corresponds to a pixel in the image. (Faster than getPixelDf(), though without any further options.)

getImageDf(object, ...)

# S4 method for class 'SPATA2'
getImageDf(
  object,
  img_name = activeImage(object),
  transform = TRUE,
  scale_fct = 1,
  ...
)

# S4 method for class 'SpatialData'
getImageDf(
  object,
  img_name = activeImage(object),
  transform = TRUE,
  scale_fct = 1
)

# S4 method for class 'HistoImage'
getImageDf(object, transform = TRUE, scale_fct = 1)

# S4 method for class 'SpatialAnnotation'
getImageDf(object, rescale_axes = TRUE, scale_fct = 1)

# S4 method for class 'Image'
getImageDf(object, scale_fct = 1)

Arguments

object

An object of class SPATA2 or, in case of S4 generics, objects of classes for which a method has been defined.

...

Used to absorb deprecated arguments or functions.

img_name

Character value. The name of the image of interest. If NULL, the active image is chosen by default. Either way, must be one of getImageNames().

transform

Logical value. Ignored if no images exist in the object. If TRUE, spatial transformation instructions saved during image alignment of the image img_name are applied. Only relevant if there are any images registered in the SPATA2 object.

rescale_axes

Logical value. If TRUE, rescales the pixel positions (height/width) to the position in the original image.

The image annotation contains a crop of the original image that only shows the area of the image annotation (plus expand, see getSpatialAnnotation()).

Value

Data.frame with three variables.

  • width: Numeric. Width value of the pixel (position on horizontal axis).

  • height: Numeric. Height value of the pixel (position on vertical axis).

  • color: Character. HEX-code of the color the pixel carries.

See also