replace_outside_surface {neurobase} | R Documentation |
Replace Values Outside Surface of image
Description
Determines values outside the surface of an image and gives a mask back with those values set to a replacement.
Usage
replace_outside_surface(
img,
value = 0,
threshold = 0,
replace_value = NA,
reorient = FALSE
)
Arguments
img |
nifti object or array |
value |
Value to check against. If zero, then
|
threshold |
Include dimension if fewer than |
replace_value |
Value to replace those outside the surface. |
reorient |
Should image be reoriented if a filename?
Passed to |
Value
Creates an array of binary values. If img
is a nifti
object, then a nifti
is returned
Examples
set.seed(5)
dims = rep(10, 3)
arr = array(0, dim = dims)
arr[ 3:5, 4:6, c(2, 6:8, 5)] = 1
nim = oro.nifti::nifti(arr)
out = replace_outside_surface(nim, replace_value = 0)
out_arr = replace_outside_surface(arr, replace_value = 0)
testthat::expect_equal(out_arr, array(out, dim = dim(out)))
[Package neurobase version 1.32.4 Index]