Skip to contents

This function smooths a volumetric image (3D brain MRI data) by applying an isotropic discrete Gaussian kernel. The blurring is performed within the specified image mask, and the kernel's standard deviation and window size can be customized.

Usage

gaussian_blur(vol, mask, sigma = 2, window = 1)

Arguments

vol

A NeuroVol object representing the image volume to be smoothed.

mask

An optional LogicalNeuroVol object representing the image mask that defines the region where the blurring is applied. If not provided, the entire volume is considered.

sigma

A numeric value specifying the standard deviation of the Gaussian kernel (default is 2).

window

An integer specifying the number of voxels around the center voxel to include on each side. For example, window=1 for a 3x3x3 kernel (default is 1).

Value

A smoothed image of class NeuroVol.

Examples

brain_mask <- read_vol(system.file("extdata", "global_mask.nii", package="neuroim2"))

# Apply Gaussian blurring to the brain volume
blurred_vol <- gaussian_blur(brain_mask, brain_mask, sigma = 2, window = 1)