objectTransform: Object Transformation

View source: R/objectTransform.R

objectTransformR Documentation

Object Transformation

Description

Function to normalize, colorize and add background to images.

Usage

objectTransform(
  mat,
  msk,
  color,
  input_range,
  mode,
  type,
  add_noise = TRUE,
  random_seed = NULL,
  size = c(0, 0),
  bg_mean = 0,
  bg_sd = 0,
  full_range = FALSE,
  force_range = FALSE,
  gamma = 1
)

Arguments

mat

a finite numeric matrix.

msk

a finite numeric matrix (mask identifying abnormalities). If missing, the default no cleansing will be done.

color

a color.

input_range

a finite numeric vector of 2 values, sets the range of the input intensity values. Values outside this range are clipped. Default is [0,4095].

mode

color mode export. Either "rgb", "gray" or "raw".

type

image object type.

add_noise

whether to add normal noise to background or not. Default is TRUE.

random_seed

a list of elements to pass to set.seed or a single value, interpreted as an integer, or NULL to be used when 'add_noise' is set to TRUE. Default is NULL. Note that NA_integer_ or list(seed = NA_integer_) can be used to not call set.seed at all.

size

a length 2 integer vector of final dimensions of the image, height 1st and width 2nd. Default is c(0,0) for no change.

bg_mean

mean value of the background added if 'add_noise' is TRUE. Default is 0.

bg_sd

standard deviation of the background added if 'add_noise' is TRUE. Default is 0.

full_range

only apply when 'mode' is not "raw", if 'full_range' is TRUE, then 'input_range' will be set to [0,4095] and 'gamma' forced to 1. Default is FALSE.

force_range

bool, only apply when 'mode' is not "raw", if 'force_range' is TRUE, then 'input_range' will be adjusted to object range in [-4095,+inf] and 'gamma' forced to 1. Default is FALSE.
Note that this parameter takes the precedence over 'input_range' and 'full_range'.

gamma

correction. Default is 1, for no correction.

Details

When 'add_noise' is FALSE and attr(msk, "removal") is "masked" or "MC", background will be automatically set to minimal pixel value.

Value

the matrix transformed according to input parameters


IFC documentation built on Sept. 14, 2023, 1:08 a.m.