Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

mask_vals-methods

Extract or Replace Values Inside a Mask


Description

Methods that act on the .Data field in a NIfTI/ANALYZE image but only on values inside a mask.

Usage

mask_vals(object, mask)

mask_vals(object, mask) <- value

## S4 replacement method for signature 'nifti'
mask_vals(object, mask) <- value

## S4 replacement method for signature 'anlz'
mask_vals(object, mask) <- value

## S4 replacement method for signature 'array'
mask_vals(object, mask) <- value

Arguments

object

is an object of class nifti or anlz.

mask

is an object of class nifti or anlz.

value

is the value to assign to the .Data field.

Examples

img = nifti(array(rnorm(10^3), dim = rep(10, 3)))
mask = img > 1.5
mask_vals(img, mask)
mask_vals(img, mask) = rep(4, sum(mask))
mask_vals(img, as(mask, "array")) = rep(4, sum(mask))
mask_vals(as(img, "array"), 
    as(mask, "array")) = rep(4, sum(mask))

neurobase

'Neuroconductor' Base Package with Helper Functions for 'nifti' Objects

v1.32.1
GPL-2
Authors
John Muschelli [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.