Skip to content

Commit

Permalink
- Added the fsleyes function for viewing files.
Browse files Browse the repository at this point in the history
  • Loading branch information
muschellij2 committed May 10, 2018
1 parent 72bbcaf commit e88511a
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: fslr
Type: Package
Title: Wrapper Functions for FSL ('FMRIB' Software Library) from Functional MRI
of the Brain ('FMRIB')
Version: 2.19.0
Version: 2.20.0
Authors@R: c(person(given = "John",
family = "Muschelli",
email = "muschellij2@gmail.com",
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export(fslerode)
export(fslerode.help)
export(fslexp)
export(fslexp.help)
export(fsleyes)
export(fslfast)
export(fslfill)
export(fslfill.help)
Expand Down
33 changes: 33 additions & 0 deletions R/fslview.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,37 @@ fslview = function(file, intern=TRUE, opts ="", verbose = TRUE, ...){
#' }
fslview.help = function(){
return(fslhelp("fslview"))
}

#' @rdname fslview
#' @export
fsleyes = function(file, intern=TRUE, opts ="", verbose = TRUE, ...){
cmd <- get.fsl()
if (is.nifti(file)) {
file = checkimg(file)
}
file = lapply(file, checkimg, ...)
if (length(file) != length(opts)) {
opts = rep(opts, length = length(file))
} else {
if (length(file) > length(opts)) {
opts = c(opts, rep("", length = (length(file) - length(opts))))
} else {
opts = opts[seq(length(file))]
}
}
file = shQuote(file)
file = paste(file, opts)
file = paste(file, collapse = " ")
fslview_cmd = "fsleyes"
##################################
# new version deprecated it
##################################
string = paste0(fslview_cmd, " %s")
cmd <- paste0(cmd, sprintf(string, file))
if (verbose) {
message(cmd, "\n")
}
res = system(cmd, intern = intern)
return(res)
}
1 change: 1 addition & 0 deletions man/fsldir.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/fslview.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e88511a

Please sign in to comment.