For an ijtiff_img-style array img (indexed as img[y, x, channel, frame]), pillar xy of channel ch is defined as img[y, x, ch, ]. These functions compute the mean, median and variance of each pillar for each channel.

sum_pillars(img, parallel = FALSE)

mean_pillars(img, parallel = FALSE)

median_pillars(img, parallel = FALSE)

var_pillars(img, parallel = FALSE)

Arguments

img

A 4-dimensional array in the style of an ijtiff_img (indexed by img[y, x, channel, frame]) or a 3-dimensional array which is a single channel of an ijtiff_img (indexed by img[y, x, frame]).

parallel

Would you like to use multiple cores to speed up this function? If so, set the number of cores here, or to use all available cores, use parallel = TRUE.

Value

An ijtiff_img-style array arr with one frame. arr[y, x, ch, 1] is equal to mean(img[y, x, ch, ]), median(img[y, x, ch, ]), or var(img[y, x, ch, ]).

Examples

aaa <- array(seq_len(2^4), dim = rep(2, 4)) # a 2-channel, 2-frame array
sum_pillars(aaa)
#> , , 1, 1
#> 
#>      [,1] [,2]
#> [1,]   10   14
#> [2,]   12   16
#> 
#> , , 2, 1
#> 
#>      [,1] [,2]
#> [1,]   18   22
#> [2,]   20   24
#> 
mean_pillars(aaa)
#> , , 1, 1
#> 
#>      [,1] [,2]
#> [1,]    5    7
#> [2,]    6    8
#> 
#> , , 2, 1
#> 
#>      [,1] [,2]
#> [1,]    9   11
#> [2,]   10   12
#> 
median_pillars(aaa)
#> , , 1, 1
#> 
#>      [,1] [,2]
#> [1,]    5    7
#> [2,]    6    8
#> 
#> , , 2, 1
#> 
#>      [,1] [,2]
#> [1,]    9   11
#> [2,]   10   12
#> 
var_pillars(aaa)
#> , , 1, 1
#> 
#>      [,1] [,2]
#> [1,]   32   32
#> [2,]   32   32
#> 
#> , , 2, 1
#> 
#>      [,1] [,2]
#> [1,]   32   32
#> [2,]   32   32
#>