Learn R Programming

fslr (version 1.9.2.1)

fsldilate: Dilate image using FSL

Description

This function calls fslmaths -ero after inverting the image to dilate an image with either the default FSL kernel or the kernel specified in kopts. The function either saves the image or returns an object of class nifti.

Usage

fsldilate(file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, kopts = "", opts = "", verbose = TRUE, ...)

Arguments

file
(character) image to be dilated
outfile
(character) resultant dilated image name
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
kopts
(character) options for kernel
opts
(character) additional options to be passed to fslmaths
verbose
(logical) print out command before running
...
additional arguments passed to readnii.

Value

Result from system command, depends if intern is TRUE or FALSE. If retimg is TRUE, then the image will be returned.

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))
mask = img > .5
dilated = fsldilate(mask, kopts = "-kernel boxv 5", retimg=TRUE)
})
}    

Run the code above in your browser using DataLab