staple_bin_img: Run STAPLE on a set of nifti images

Description Usage Arguments Value Examples

View source: R/staple_binimg.R

Description

Run STAPLE on a set of nifti images

Usage

1
2
3
staple_bin_img(x, set_orient = FALSE, verbose = TRUE, ...)

staple_multi_img(x, set_orient = FALSE, verbose = TRUE, ...)

Arguments

x

Character vector of filenames or list of arrays/images

set_orient

Should the orientation be set to the same if the images are niftiImages

verbose

print diagnostic messages

...

Additional arguments to staple_bin_mat

Value

A list similar to staple_bin_mat, but has a resulting image

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
n = 5
r = 1000
x = lapply(seq(n), function(i) {
   x = rbinom(n = r, size = 1, prob = 0.5)
   array(x, dim = c(10,10, 10))
 })
staple_out = staple_bin_img(x, set_orient = FALSE)
res = staple(x)
testthat::expect_equal(staple_out$sensitivity,
res$sensitivity)

x = lapply(x, RNifti::asNifti, internal = FALSE)
staple_img_out = staple_bin_img(x, set_orient = FALSE)
testthat::expect_equal(staple_out$sensitivity,
staple_img_out$sensitivity)
n = 5
r = 1000
x = lapply(seq(n), function(i) {
   x = rbinom(n = r, size = 5, prob = 0.5)
   array(x, dim = c(10,10, 10))
 })
staple_out = staple_multi_img(x, set_orient = FALSE)

muschellij2/stapler documentation built on May 17, 2020, 3:39 a.m.