Learn R Programming

fslr (version 1.0)

fslfill: Fill image holes

Description

This function calls fslmaths -fillh to fill in image holes and either saves the image or returns an object of class nifti

Usage

fslfill(file, outfile = NULL, bin = TRUE, retimg = FALSE,
  reorient = FALSE, intern = TRUE, ...)

Arguments

file
(character) filename of image to be filled
outfile
(character) name of resultant filled file
bin
(logical) binarize the image before filling
retimg
(logical) return image of class nifti
reorient
(logical) If retimg, should file be reoriented when read in? Passed to readNIfTI.
intern
(logical) pass to system
...
additional arguments passed to readNIfTI.

Value

  • character or logical depending on intern

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))
mask = img > .5
eroded = fslerode(mask, kopts = "-kernel boxv 5", retimg=TRUE)
filled = fslfill(eroded, retimg= TRUE)
})
}

Run the code above in your browser using DataLab