arr.mask | R Documentation |
Transform a rank-3 array called arr
, represented by, \mathbb{T} = T_{m,n,p}
, using a matrix called mask
, represented by \mathbb{M}=(m_{ij})_{m \times n}
.
Masks each matrix T_{m,n,p}\,\forall\, p \in \{1, 2, 3, \dots , N\}
using the same mask
\mathbb{M}=(m_{ij})_{m \times n}
.
Any matrix slice T_{m,n,k}
and the mask
have the same dimensionality, i.e. m \times n
. See mat.mask for details.
arr.mask(arr, mask, drop.dat = F)
arr.mask(arr, mask, drop.dat = T)
arr.mask(arr, mask)
arr |
The rank-3 array, |
mask |
The masking matrix, |
drop.dat |
Boolean bit, defaults to |
The returned value is always a rank-3 array.
Whether the dimensions of the output and arr
are same or not, depends on drop.dat
.
Please see mat.mask for more details.
Chitran Ghosal
###plot the original image and convert it to an array
dat <- system.file("extdata", "STM.png", package = "StatsChitran")
tens <- img_2_arr(source.png = dat, x.lim = c(0, 6.115*10^-9), y.lim = c(0, 6.115*10^-9))
plot2D.arr(arr = tens)
###create the mask
mask_x <- tens[,,2] >= 2*10^-9 & tens[,,2] <=4*10^-9
mask_y <- tens[,,3] >= 2.5*10^-9 & tens[,,3] <= 5.5*10^-9
mask <- mask_x & mask_y
####points not dropped
arr.res <- arr.mask(arr = tens, mask = mask, drop.dat = F)
plot2D.arr(arr.res)
####points dropped
arr.res <- arr.mask(arr = tens, mask = mask, drop.dat = T)
plot2D.arr(arr.res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.