Sim.3D.GRF: Simulate a GRF (adopted from 'AnalyzeFMRI')

View source: R/external.R

Sim.3D.GRFR Documentation

Simulate a GRF (adopted from AnalyzeFMRI)

Description

Simulates a Gaussian Random Field with specified dimensions and covariance structure.

Usage

Sim.3D.GRF(d, voxdim, sigma, ksize, mask=NULL, type=c("field","max"))

Arguments

d

A vector specifying the dimensions of a 3D or 4D array.

voxdim

The dimensions of each voxel.

sigma

The 3D covariance matrix of the field.

ksize

The size (in voxels) of the kernel with which to filter the independent field.

mask

A 3D mask for the field.

type

If type=="field" then the simulated field together with the maximum of the field is returned.If type=="max" then the maximum of the field is returned.

Details

The function works by simulating a Gaussian r.v at each voxel location and the smoothing the field with a discrete filter to obtain a field with the desired covariance structure.

Value

mat

Contains the simulated field if type=="field", else NULL

max

The maximum value of the simulated field

Author(s)

J. L. Marchini

See Also

GaussSmoothKernel

Examples

     d <- c(64, 64, 21)
     FWHM <- 9
     sigma <- diag(FWHM^2, 3) / (8 * log(2))
     voxdim <- c(2, 2, 4)
     msk <- array(1, dim = d)   
     field <- Sim.3D.GRF(d = d, voxdim = voxdim, sigma = sigma, 
		ksize = 9, mask = msk, type = "max")


neuRosim documentation built on Oct. 18, 2023, 5:09 p.m.