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
)
the matrix transformed according to input parameters
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 range of the input intensity values. Values outside this range are clipped. Default is [0,4095]
.
color mode export. Either "rgb"
, "gray"
or "raw"
.
image object type.
whether to add normal noise to background or not. Default is TRUE
.
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.
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 if 'add_noise'
is TRUE
. Default is 0
.
standard deviation of the background added if 'add_noise'
is TRUE
. Default is 0
.
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
.
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'
.
correction. Default is 1
, for no correction.
When 'add_noise'
is FALSE
and attr(msk, "removal")
is "masked"
or "MC"
,
background will be automatically set to minimal pixel value.