-
Notifications
You must be signed in to change notification settings - Fork 11
/
fslr_Generic_fslmaths.R
37 lines (34 loc) · 1.23 KB
/
fslr_Generic_fslmaths.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
34
35
36
37
#' @title %propername% Images using FSL
#' @description This function calls \code{fslmaths -%opt%}.
#' The R functions wraps \code{fslmaths}
#' @param file (character) input image
#' @param file2 (character) 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,
file2,
outfile=NULL,
retimg = TRUE,
reorient = FALSE,
intern = FALSE,
opts = "",
...){
file2 = checkimg(file2, ...)
all.opts = paste(paste("-%opt% ", file2),
opts, collapse=" ")
res = fslmaths(file=file,
outfile=outfile,
retimg=retimg, reorient=reorient,
intern=intern, opts = all.opts, ...)
return(res)
}