getImages: Get Paired Microscopic Images

View source: R/getImages.R

getImagesR Documentation

Get Paired Microscopic Images

Description

Return a list of paired DNA and fluorescent images appropriate for parseImages.

Usage

getImages(
  source,
  type = "tiff",
  which.images = c(1, 2, 2),
  pattern = NULL,
  verbose = FALSE
)

Arguments

source

A character vector identifying the source of images. The source can be a directory with subdirectories, each of which contains images organized as specified by which.images. In typical use, each subdirectory is the name of the well from a multi- well dish suchg as A1, C03, d003, etc. Alternatively, the source can be a character string of a .zip file or character vector of image files organized as indicated by which.images.

type

A character string identifying the type of image files to parse ("tif", tiff", jpeg", jpg or png").

which.images

An integer of length 2 or 3 or NULL. The first number indicates the position of the DNA image. The second number indicates the position of "target" image. The optional third number specifies the total number of images for each field. If this is not specified, the maxmimum of which.images[1:2] will be used for this value. If NULL, no order is assumed and no consistency checks are performed. The default of c(1, 2) indicates a DNA image followed by target image. A value of c(2, 1) indicates that the target image is followed by the DNA image in pairs of images. A value of c(1, 2, 4) indicates a DNA image, a target image, and two additional images, which are ignored, in each set of four images.

pattern

Optional grep pattern as character string used by list.files to select image files.

verbose

If TRUE, print diagnostic messages as files are read.

Details

Images specified in source will be evaluated with the same logic in checkImages to determine if the proper number of files are present. The order required by parseImages is the DNA image first and the fluorescent viral target second. The position of the DNA image and the target image within each set of images can be changed with the which.images argument.

Images associated with each multiplicity of infection can be individual files in a single directory where each directory named as the well such as A1, A2, etc. and the files within are identified as A1/file001.tif, A1/file002.tif, etc. The well identifier can be in upper or lower case and can contain leading zeros such as c0003/file12.tif as well as a numeric prefix such as 1A3.

Alternatively, each group of images associated with a given moi can be a multi-layered tiff file where the sequence of images in the file is specified by the argument which.images.

If 'source' is one or more zip files, files in the temporary directory (tempdir) will be deleted in order to receive the compressed files.

Value

A list of two named lists containing the nuclear and target images. Each well or file will be represented as an element in the lists nuc and tgt. Diagnostic messages are provided if verbose is TRUE.

Examples

# Example with data organized by folder or well
  path.by.folder <- system.file("extdata", "by_folder", package = "virustiter")
  getImages(path.by.folder)


ornelles/virustiter documentation built on March 29, 2024, 8:30 p.m.