remake_img: Remake Image from Vector

View source: R/remake_img.R

remake_imgR 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)


neurobase documentation built on May 29, 2024, 2:17 a.m.