Learn R Programming

fslr (version 1.9.2.1)

fslsmooth: Gaussian smooth image using FSL

Description

This function calls fslmaths -s to smooth an image and either saves the image or returns an object of class nifti

Usage

fslsmooth(file, sigma = 10, mask = NULL, smooth_mask = TRUE, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, verbose = TRUE, ...)

Arguments

file
(character) image to be smoothed
sigma
(numeric) sigma (in mm) of Gaussian kernel for smoothing
mask
(character) optional mask given for image
smooth_mask
(logical) Smooth mask? If TRUE, the masked image will be divided by the smoothed mask.
outfile
(character) resultant smoothed image name (optional) if not give, will be the stub of the filename then _sigma
retimg
(logical) return image of class nifti
reorient
(logical) If retimg, should file be reoriented when read in? Passed to readnii.
intern
(logical) to be passed to system
verbose
(logical) print out command before running
...
additional arguments passed to readnii.

Value

Result from system command, depends if intern is TRUE or FALSE.

Examples

Run this code
if (have.fsl()){
system.time({
dims = c(50, 50, 20)
x = array(rnorm(prod(dims)), dim = dims)
img = nifti(x, dim= dims, 
datatype = convert.datatype()$FLOAT32, cal.min = min(x), 
cal.max = max(x), pixdim = rep(1, 4))
s.img = fslsmooth(img, retimg=TRUE)
})
}

Run the code above in your browser using DataLab