sum_neighbors_vol {fMRItools}R Documentation

Sum of each voxel's neighbors

Description

For each voxel in a 3D logical or numeric array, sum the values of the six neighboring voxels.

Usage

sum_neighbors_vol(arr, pad = 0)

Arguments

arr

The 3D array.

pad

In order to compute the sum, the array is temporarily padded along each edge with the value of pad. 0 (default) will mean that edge voxels reflect the sum of 3-5 neighbors whereas non-edge voxels reflect the sum of 6 neighbors. An alternative is to use a value of NA so that edge voxels are NA-valued because they did not have a complete set of six neighbors. Perhaps another option is to use mean(arr).

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

Value

An array with the same dimensions as arr. Each voxel value will be the sum across the immediate neighbors. If arr was a logical array, this value will be between 0 and 6.


[Package fMRItools version 0.4.7 Index]