-
Notifications
You must be signed in to change notification settings - Fork 11
/
fslr_Generic_fslmaths_onefile.R
33 lines (30 loc) · 1.12 KB
/
fslr_Generic_fslmaths_onefile.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#' @title %propername% Image using FSL
#' @description This function calls \code{fslmaths -%opt%}.
#' The R functions wraps \code{fslmaths}
#' @param file (character) input image to %longname%
#' @param outfile (character) resultant image name (optional)
#' @param retimg (logical) return image of class nifti
#' @param reorient (logical) If retimg, should file be reoriented
#' when read in?
#' Passed to \code{\link{readnii}}.
#' @param intern (logical) to be passed to \code{\link{system}}
#' @param opts (character) operations to be passed to \code{fslmaths}
#' @param ... additional arguments passed to \code{\link{readnii}}.
#' @return If \code{retimg} then object of class nifti. Otherwise,
#' Result from system command, depends if intern is TRUE or FALSE.
#' @export
fsl%opt% = function(
file,
outfile=NULL,
retimg = TRUE,
reorient = FALSE,
intern = FALSE,
opts = "",
...){
all.opts = paste("-%opt% ", opts, collapse=" ")
res = fslmaths(file=file,
outfile=outfile,
retimg=retimg, reorient=reorient,
intern=intern, opts = all.opts, ...)
return(res)
}