Learn R Programming

fslr (version 1.0)

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, outfile = NULL, retimg = FALSE,
  reorient = FALSE, intern = 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
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 readNIfTI.
intern
(logical) to be passed to system
...
additional arguments passed to readNIfTI.

Value

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

Examples

Run this code
if (have.fsl()){
system.time({
x = array(rnorm(1e6), dim = c(100, 100, 100))
img = nifti(x, dim= c(100, 100, 100),
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