Skip to content

Commit

Permalink
Fix error messages for missing sample brain
Browse files Browse the repository at this point in the history
  • Loading branch information
jefferis committed Sep 9, 2016
1 parent 2265d28 commit 3e5d0d5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions R/transformation.R
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ shortest_bridging_seq <-
#' directions. See details.
#' @param ... extra arguments to pass to \code{\link[nat]{xform}}.
#' @export
#' @seealso \code{\link{mirror_brain}}, \code{\link{regtemplate}}
#' @examples
#' ## depends on nat.flybrains package and system CMTK installation
#' \dontrun{
Expand Down Expand Up @@ -329,6 +330,9 @@ shortest_bridging_seq <-
#' }
xform_brain <- function(x, sample=regtemplate(x), reference, via=NULL,
imagedata=is.character(x), checkboth=NULL, ...) {
if(is.null(sample))
stop("Invalid sample argument!\n",
"Either specify manually or use regtemplate(x) <- to set space for x.")
if(is.null(via)) {
# use bridging_graph, with checkboth = TRUE
if(is.null(checkboth)) checkboth=TRUE
Expand All @@ -354,6 +358,7 @@ xform_brain <- function(x, sample=regtemplate(x), reference, via=NULL,
#' @param transform whether to use warp (default) or affine component of
#' registration, or simply flip about midplane of axis.
#' @param ... extra arguments to pass to \code{\link[nat]{mirror}}.
#' @seealso \code{\link{xform_brain}}, \code{\link{regtemplate}}
#' @export
#' @examples
#' data(FCWB.demo)
Expand Down Expand Up @@ -395,6 +400,9 @@ xform_brain <- function(x, sample=regtemplate(x), reference, via=NULL,
mirror_brain <- function(x, brain=regtemplate(x), mirrorAxis=c("X","Y","Z"),
transform = c("warp", "affine", "flip"), ...) {
transform=match.arg(transform)
if(is.null(brain))
stop("Invalid brain argument!\n",
"Either specify manually or use regtemplate(x) <- to set space for x.")
warpfile <- if(transform=="flip") NULL else mirror_reg(brain)
mirrorAxis <- match.arg(mirrorAxis)
axisCol <- which(mirrorAxis == c("X", "Y", "Z"))
Expand Down
3 changes: 3 additions & 0 deletions man/mirror_brain.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/xform_brain.Rd

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

0 comments on commit 3e5d0d5

Please sign in to comment.