Learn R Programming

fMRItools (version 0.7.2)

dilate_mask_vol: Dilate 3D mask

Description

Dilate a volumetric mask by a certain number of voxel layers. For each layer, any out-of-mask voxel adjacent to at least one in-mask voxel is added to the mask.

Usage

dilate_mask_vol(vol, n_dilate = 1, out_of_mask_val = NA, new_val = 1)

Value

The dilated vol. It is the same as vol, but dilated voxels are replaced with new_val.

Arguments

vol

The 3D array to dilate. The mask to dilate is defined by all values not in out_of_mask_val.

n_dilate

The number of layers to dilate the mask by. Default: 1.

out_of_mask_val

A voxel is not included in the mask if and only if its value is in this vector. Default: NA. If vol is simply a logical array with TRUE values for in-mask voxels, use out_of_mask_val=FALSE.

new_val

Value for voxels newly added to the mask. Default: 1. If vol is simply a logical array with TRUE values for in-mask voxels, use new_val=1.

Details

Diagonal voxels are not considered adjacent, i.e. the voxel at (0,0,0) is not adjacent to the voxels at (1,1,0) or (1,1,1), although it is adjacent to (1,0,0).