finite_img-methods | R Documentation |
Simple wrapper for setting non-finite values to zero
finite_img(img, replace = 0)
## S4 method for signature 'nifti'
finite_img(img, replace = 0)
## S4 method for signature 'array'
finite_img(img, replace = 0)
## S4 method for signature 'ANY'
finite_img(img, replace = 0)
## S4 method for signature 'character'
finite_img(img, replace = 0)
## S4 method for signature 'list'
finite_img(img, replace = 0)
img |
character path of image or
an object of class |
replace |
Value to replace non-finite values to |
nifti object
John Muschelli muschellij2@gmail.com
set.seed(5)
dims = rep(10, 3)
arr = array(rpois(prod(dims), lambda = 2), dim = dims)
arr[c(5, 6, 7, 8)] = c(NA, NaN, Inf, -Inf)
nim = nifti(arr)
finite_img(nim)
finite_img(arr)
tfile = tempimg(nim)
checkimg(c(tfile, tfile))
checkimg(list(tfile, tfile))
finite_img(list(tfile, tfile))
finite_img(c(tfile, tfile))
img = RNifti::readNifti(tfile)
checkimg(img)
img[c(5, 6, 7, 8)] = c(NA, NaN, Inf, -Inf)
stopifnot(!any(c(is.na(c(finite_img(img))))))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.