Extracts or computes the side length of pixel sides depending on the current resolution of the image.

getPixelScaleFactor(
  object,
  unit,
  switch = FALSE,
  force = FALSE,
  add_attr = TRUE,
  verbose = NULL,
  ...
)

Arguments

object

An object of class spata2.

unit

The desired unit. Defaults to the unit in which the original size of the image of the spatial method is provided. Obtain valid input options with validUnitsOfLengthSI().

switch

Logical value. If TRUE, the unit of the output is switched. See details for more.

force

Logical value. If TRUE, the scale factor is computed regardless of what the function finds in the respective slot.

verbose

Logical. If set to TRUE informative messages regarding the computational progress will be printed.

(Warning messages will always be printed.)

...

Used to absorb deprecated arguments or functions.

Value

A single numeric value with the unit defined in attribute unit.

If switch is FALSE, the default, the output is to be interpreted as unit/pixel. E.g. an output of 15 'um/px' means that under the current resolution of the image height and width of one pixel corresponds to 15 um in height and width in the original tissue.

If switch is TRUE, the output is to be interpreted as pixel/unit. E.g. an output value of 0.07 'px/um' means that under the current image resolution one micrometer corresponds to 0.07 pixel in the image.