From 6cd5d966c7d44cbd3cf7a13d7bad72aaaed1b622 Mon Sep 17 00:00:00 2001 From: muschellij2 Date: Wed, 28 Aug 2019 12:28:51 -0400 Subject: [PATCH] updated the docs and help for robex main --- .gitignore | 1 + R/robex.R | 34 +++++++++++++++++++++------------- man/robex.Rd | 4 ++-- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 28b5631..064aef8 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ inst/runROBEX.sh inst/ROBEX src/ ROBEX/ +ROBEX.zip diff --git a/R/robex.R b/R/robex.R index d15fcdd..ef8c1e2 100644 --- a/R/robex.R +++ b/R/robex.R @@ -9,10 +9,10 @@ #' @examples #' result = robex(infile = "", outfile = "") #' -#' if (requireNamespace("kirby21.t1")) { +#' if (requireNamespace("kirby21.t1", quietly = TRUE)) { #' infile = kirby21.t1::get_t1_filenames(id = "113", visit = 1) #' if (is.null(infile)) { -#' infile = "" +#' infile = "" #' } #' if (!file.exists(infile)) { #' outdir = tempdir() @@ -37,20 +37,27 @@ robex = function( ...){ - infile = neurobase::checkimg(infile) xinfile = infile - infile = shQuote(infile) + if (file.exists(infile)) { + infile = neurobase::checkimg(infile) + infile = normalizePath(infile) + infile = shQuote(infile) + } xoutfile = outfile - outfile = path.expand(outfile) - outfile = normalizePath(outfile, "/") - outfile = file.path(normalizePath(dirname(outfile), "/"), - basename(outfile)) - if (.Platform$OS.type == "windows") { - outfile = gsub("\\", "/", outfile, fixed = TRUE) - outfile = gsub("/+", "/", outfile) - outfile = gsub("/", "\\\\", outfile) + if (length(outfile) > 0) { + if (nchar(outfile) > 0) { + outfile = path.expand(outfile) + outfile = normalizePath(outfile, winslash = "/") + outfile = file.path(normalizePath(dirname(outfile), "/"), + basename(outfile)) + if (.Platform$OS.type == "windows") { + outfile = gsub("\\", "/", outfile, fixed = TRUE) + outfile = gsub("/+", "/", outfile) + outfile = gsub("/", "\\\\", outfile) + } + outfile = shQuote(outfile) + } } - outfile = shQuote(outfile) # install_robex() @@ -83,3 +90,4 @@ robex = function( outfile = xoutfile) ) } ## end robex + diff --git a/man/robex.Rd b/man/robex.Rd index d88309a..0f3c498 100644 --- a/man/robex.Rd +++ b/man/robex.Rd @@ -26,10 +26,10 @@ Executes Robust Brain Extraction \examples{ result = robex(infile = "", outfile = "") -if (requireNamespace("kirby21.t1")) { +if (requireNamespace("kirby21.t1", quietly = TRUE)) { infile = kirby21.t1::get_t1_filenames(id = "113", visit = 1) if (is.null(infile)) { - infile = "" + infile = "" } if (!file.exists(infile)) { outdir = tempdir()