Replace Values Outside Surface of image
Determines values outside the surface of an image and gives a mask back with those values set to a replacement.
replace_outside_surface( img, value = 0, threshold = 0, replace_value = NA, reorient = FALSE )
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 |
Creates an array of binary values. If img is a nifti
object, then a nifti is returned
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)))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.