bilateral_filter {neuroim2} | R Documentation |
Apply a bilateral filter to a volumetric image
Description
This function smooths a volumetric image (3D brain MRI data) using a bilateral filter. The bilateral filter considers both spatial closeness and intensity similarity for smoothing.
Usage
bilateral_filter(vol, mask, spatial_sigma = 2, intensity_sigma = 1, window = 1)
Arguments
vol |
A |
mask |
An optional |
spatial_sigma |
A numeric value specifying the standard deviation of the spatial Gaussian kernel (default is 2). |
intensity_sigma |
A numeric value specifying the standard deviation of the intensity Gaussian kernel (default is 25). |
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_v4.nii", package="neuroim2"))
# Apply bilateral filtering to the brain volume
filtered_vol <- bilateral_filter(brain_mask, brain_mask, spatial_sigma = 2,
intensity_sigma = 25, window = 1)