gaussian_blur | R Documentation |
This function applies an isotropic discrete Gaussian kernel to smooth a volumetric image (3D brain MRI data). The blurring is performed within a specified image mask, with customizable kernel parameters.
gaussian_blur(vol, mask, sigma = 2, window = 1)
vol |
A |
mask |
An optional |
sigma |
A numeric value specifying the standard deviation of the Gaussian kernel. Default is 2. |
window |
An integer specifying the kernel size. It represents the number of voxels to include on each side of the center voxel. For example, window=1 results in a 3x3x3 kernel. Default is 1. |
The function uses a C++ implementation for efficient Gaussian blurring. The blurring is applied only to voxels within the specified mask (or the entire volume if no mask is provided). The kernel size is determined by the 'window' parameter, and its shape by the 'sigma' parameter.
A NeuroVol
object representing the smoothed image.
Gaussian blur: https://en.wikipedia.org/wiki/Gaussian_blur
NeuroVol-class
, LogicalNeuroVol-class
, bilateral_filter
# Load a sample brain mask
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)
# View a slice of the original and blurred volumes
image(brain_mask[,,50])
image(blurred_vol[,,50])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.