minmax_img-methods | R Documentation |
Calculates the range of values in an image, then scales the image minimum to 0 and maximum to 1
minmax_img(img)
## S4 method for signature 'nifti'
minmax_img(img)
## S4 method for signature 'array'
minmax_img(img)
## S4 method for signature 'ANY'
minmax_img(img)
## S4 method for signature 'character'
minmax_img(img)
## S4 method for signature 'factor'
minmax_img(img)
## S4 method for signature 'list'
minmax_img(img)
img |
character path of image or
an object of class |
A nifti
object (or list of them) or class of
object passed in if not specified
set.seed(5)
dims = rep(10, 4)
arr = array(rpois(prod(dims), lambda = 2), dim = dims)
nim = oro.nifti::nifti(arr)
mimg = minmax_img(nim)
marr = minmax_img(arr)
testthat::expect_equal(array(mimg, dim = dim(mimg)), marr)
set.seed(5)
dims = rep(10, 3)
arr = array(rnorm(prod(dims)), dim = dims)
arr[,,10] = 0
nim = oro.nifti::nifti(arr)
rnifti = RNifti::asNifti(nim)
timg = tempimg(nim)
limg = list(factor(timg), factor(timg))
func = minmax_img
func(arr)
func(nim)
func(rnifti)
func(timg)
func(limg)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.