cell.load.boundaries: Load CellID boundary data to a dataframe

View source: R/load_mask_data.R

cell.load.boundariesR Documentation

Load CellID boundary data to a dataframe

Description

Load CellID boundary data to a dataframe

Usage

cell.load.boundaries(
  data.source,
  position_pattern = ".*Position(\\d+)$",
  tsv_pattern = "^out_all_masks.tsv(?:\\.gz)?$",
  cell_id_offset = -1,
  interior_offset = NULL,
  blank_bg = NULL,
  arguments = NULL,
  pixel.type = "b",
  flags = NULL,
  close.paths = FALSE,
  cell.data = NULL,
  tiff.channel = "BF.out"
)

Arguments

data.source

Either "out.tif" or "masks.tsv".

position_pattern

A regex pattern with one group for the integer position number, extracted from the directory name holding the TSV file.

tsv_pattern

A regex pattern matching the name of the TSV file (readr::read_tsv supports reading "gz" compressed files direclty).

cell_id_offset

integer. The pixel intensity offset with respect to maximum pixel intensity, such that cellID = maximum_intensity - boundary_intensity + cell_id_offset.

interior_offset

logical. If TRUE the function expects that cell masks have interior pixels offset from boundary pixels (set to TRUE if NULL; the default).

blank_bg

logical. If TRUE the function assumes that the image background (i.e., non-mask pixels) are blank. Set to FALSE if left NULL (the default).

arguments

The arguments dataframe used to run cellid (prepared with rcell2.cellid::arguments).

pixel.type

When data.source = "masks.tsv", you may choose the pixel "type". At least one of c("i", "b") for interior and/or boundary pixels ("b" by default).

flags

Used to subset the input files by CellID's "flag" field. Each flag corresponds to an imaging channel, according to a "mapping" found in cell.data$mapping (available when using get_cell_data).

close.paths

When TRUE and data.source = "masks.tsv", append the first row to the end of the data.frame (groping by cellID and pos). Useful for plotting of making closed polygons.

cell.data

When data.source = "out.tif", you **must** provide the cell.data object (prepared with rcell2.cellid::get_cell_data).

tiff.channel

When data.source = "out.tif", provide the channel name for images holding boundary data ('BF.out' by default).

Details

Using data_source = "out.tif" will give **un** ordered boundary pixels. See read_tiff_masks for details and caveats. CellID must have been run with the "encode_cellID_in_pixels" option enabled.

Using data_source = "masks.tsv" will give ordered boundary pixels. CellID must have been run with the "output_coords_to_tsv" option enabled. However, in some cases, the pixel sequence may not be "manifold" (see: https://github.com/darksideoftheshmoo/cellID-linux/issues/11). Also, do not expect them to be consistent in their direction (clockwise or anti-clockwise), and double check if the pixels are aligned to the output images (see: https://github.com/darksideoftheshmoo/rcell2/issues/29).

Value

A "cell.boundaries" data.frame.


darksideoftheshmoo/rcell2 documentation built on Oct. 23, 2024, 12:59 p.m.