Learn R Programming

fslr (version 1.0)

fslsub2: Subsample image by factor of 2

Description

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

Usage

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

Arguments

file
(character) filename of image to be subsampled
outfile
(character) name of resultant subsampled file
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))
subsamp = fslsub2(img, retimg=TRUE)
print(voxdim(subsamp))
})
}

Run the code above in your browser using DataLab