Learn R Programming

IFC (version 0.1.1)

objectCleanse: Object Cleanser

Description

Removes abnormalities (clipped/debris) from image.

Usage

objectCleanse(mat, msk, add_noise = TRUE, random_seed = NULL, bg = 0, sd = 0)

Arguments

mat

a numeric matrix (image).

msk

a numeric matrix (mask identifying abnormalities).

add_noise

if TRUE adds normal noise to background using rnorm(), from Rcpp. Default is TRUE.

random_seed

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.

bg

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

sd

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

Value

According to msk, pixel values in mat are substituted by either bg [add_noise == FALSE] or rnorm(n = prod(dim(mat), mean=bg, sd=sd)) [add_noise == TRUE].