Official constructor function of the S4 class HistoImage. See details for different input options of dirand image.

createHistoImage(
  img_name,
  sample,
  dir = NULL,
  img = NULL,
  active = FALSE,
  scale_factors = list(),
  reference = FALSE,
  verbose = TRUE,
  ...
)

Arguments

img_name

Character value. The name of the HistoImage with which to refer to it via arguments img_name and img_names.

sample

Character value. The sample name to which the image belongs. Should be equal to slot @sample of the SpatialData object in which the HistoImage is stored.

dir

Character value. The directory from where to retrieve the image.

img

An image. Must be usable with EBImage::as.Image().

scale_factors

list. Sets slot @scale_factors,

reference

Logical value. If TRUE, the HistoImage is treated as the reference image for all other registered images in the SpatialData object.

verbose

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

(Warning messages will always be printed.)

...

Used to absorb deprecated arguments or functions.

Value

An object of class HistoImage

Details

The HistoImage object stores the image as well as additional information regarding the image. Among other things, it can store a file directory. This, in turn, allows to conveniently use multiple images in a SPATA2 object and in downstream analysis without having to store them all together in the object which can occupy a lot of unnecessary memory storage. The HistoImage can be created in three ways.

First (recommended): The directory is specified via dir and img is NULL. In this case, the function reads the image from the directory and stores both, the image as well as the directoryin the HistoImage container. Since the directory is stored, too, the image can be conveniently unloaded and loaded in downstream analysis.

Second: The image is provided via img and the directory dir is NULL. In this case, the function creates the HistoImage container and stores the image but since no directory is available, unloading and loading later on is not possible.

Third: Both, img and dir is specified. In this case, the image is stored in the HistoImage container next to the directory and if the directory dir does not exist, the directory is used to save the image on the device which allows unloading and loading later on.

See also