Function to normalize, colorize and add background to images.
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
)
a finite numeric matrix.
a finite numeric matrix (mask identifying abnormalities). If missing, the default no cleansing will be done.
a color.
a finite numeric vector of 2 values, sets the 'input_range' of the input intensity values; values exceeding this 'input_range' are clipped.
color mode export. Either "rgb", "gray" or "raw".
image object type.
logical, if TRUE adds normal noise to background using rnorm(), from Rcpp. Default is TRUE.
a single value, interpreted as an integer, or NULL to be used with set.seed() from base when 'add_noise' is set to TRUE. Default is NULL.
a length 2 integer vector of final dimensions of the image, height 1st and width 2nd. Default is c(0,0) for no change.
mean value of the background added. Default is 0.
standard deviation of the background added. Default is 0.
logical, only apply when mode is not "raw", if 'full_range' is TRUE, then input_range will be set to c(0, 4095) and 'gamma' forced to 1. Default is FALSE.
logical, 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.
the matrix transformed according to input parameters
When 'add_noise' is FALSE and 'msk', `removal` attribute has value "masked" or "MC", backgound will be automatically set to minimal pixel value.