Skip to contents

Computes per-voxel temporal signal-to-noise ratio across a list of NeuroVec runs by aggregating first and second moments over time and runs.

Usage

compute_tsnr(nv_list)

Arguments

nv_list

List of neuroim2::NeuroVec runs.

Value

Numeric vector of length V (voxels) with tSNR values.

Details

For each voxel, the mean and variance are computed over concatenated time points across runs. tSNR is max(1e-6, mean) / max(1e-6, sd), then lower- bounded at 1e-6 to avoid degenerate weights.

Examples

# \donttest{
# Create simple test data
dims <- c(10, 10, 5, 20)  # 4D: x, y, z, time
space <- neuroim2::NeuroSpace(dims,
                               spacing = c(1, 1, 1),
                               origin = c(0, 0, 0))
mask <- array(TRUE, dims[1:3])  # 3D mask

# Create two runs with random data
data1 <- array(rnorm(prod(dims)), dims)
data2 <- array(rnorm(prod(dims)), dims)
nv1 <- neuroim2::NeuroVec(data1, space, mask = mask)
nv2 <- neuroim2::NeuroVec(data2, space, mask = mask)

tsnr <- compute_tsnr(list(nv1, nv2))
# }