remake_img {neurobase}R Documentation

Remake Image from Vector

Description

Wrapper function to take a vector of values and result in a nifti object

Usage

remake_img(vec, img, mask = NULL, warn = FALSE, ...)

Arguments

vec

vector of values to be in resulting image

img

object of class nifti to put vector into

mask

binary array/ nifti object to denote where vector values are to be.

warn

Should a warning be issued if defaulting to FLOAT32?

...

additional arguments passed to datatyper

Value

Object of class nifti

See Also

niftiarr

Examples

set.seed(5)
dims = rep(10, 3)
arr = array(rnorm(prod(dims)), dim = dims)
arr[,,10] = 0
nim = oro.nifti::nifti(arr)
remake_img(c(nim), nim)
mask = nim > 5
vals = nim[mask]
vals = sqrt(vals)
remake_img(vals, nim, mask = mask)


[Package neurobase version 1.32.4 Index]