read_tiff_masks: Read cell masks from BF.out

View source: R/load_mask_data.R

read_tiff_masksR Documentation

Read cell masks from BF.out

Description

Read boundary and interior pixel data from a BF.out TIFF image.

Usage

read_tiff_masks(
  path,
  cell_id_offset = -1,
  interior_offset = NULL,
  blank_bg = NULL
)

Arguments

path

A string. The path to the 16-bit BF.out tiff file to read.

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).

Details

This function reads cell masks from 16-bit "BF.out" images produced by Cell-ID, onto which boundary and interior pixels have been encoded as intensity values proportional to each segmented object's cellID.

By default the function accounts for the possibility that the image may have a brightfield image background and/or interior pixel intensities offset from boundary pixels. It then first identifies the boundary pixel range, then checks if the image also has offset interior pixels, and finally extracts boundary and interior pixels separately. This behavior can be overridden by explicitly specifying the image type via the blank_bg and interior_offset parameters. This may speed up running time.

Limitations: this function only uses information from 16-bit "brightfield" images output by CellID. The fluoresence channels output images are 8-bit, and do not contain the necessary information. This might be relevant if the fluorescent images were aligned to the BF by CellID, such that the pixel coordinates differ between brightfield and fluorescence output images. If this is a problem for you, then use cell.load.boundaries with data.source = 'masks.tsv' to read CellID's TSV output files (for that see cell2).

See CellID's mask_mod branch for more details: https://github.com/darksideoftheshmoo/cellID-linux/blob/mask_mod/README.md#branch-notes

Value

A data frame of mask pixels ordered by cellID.


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