Skip to content

Commit

Permalink
export method
Browse files Browse the repository at this point in the history
  • Loading branch information
jefferis committed Jun 13, 2023
1 parent 5a0175d commit 58b2de2
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 85 deletions.
113 changes: 57 additions & 56 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,56 +1,57 @@
# Generated by roxygen2: do not edit by hand

S3method(as.character,templatebrain)
S3method(as.im3d,templatebrain)
S3method(as.templatebrain,character)
S3method(as.templatebrain,im3d)
S3method(as.templatebrain,templatebrain)
S3method(boundingbox,templatebrain)
S3method(dim,templatebrain)
S3method(display_slice,templatebrain)
S3method(origin,templatebrain)
S3method(plot3d,templatebrain)
S3method(print,templatebrain)
S3method(voxdims,templatebrain)
export("regtemplate<-")
export(add_reg_folders)
export(add_reglist)
export(all_templatebrains)
export(allreg_dataframe)
export(as.templatebrain)
export(bridging_graph)
export(bridging_sequence)
export(display_slice)
export(download_reg_repo)
export(extra_reg_folders)
export(fit_xform)
export(fit_xform_brain)
export(guess_templatebrain)
export(is.templatebrain)
export(local_reg_dir_for_url)
export(mirror_brain)
export(regtemplate)
export(shortest_bridging_seq)
export(templatebrain)
export(update_reg_repos)
export(xform_brain)
importFrom(digest,digest)
importFrom(igraph,"E<-")
importFrom(igraph,E)
importFrom(igraph,get.shortest.paths)
importFrom(igraph,graph.edgelist)
importFrom(igraph,shortest.paths)
importFrom(igraph,vertex_attr)
importFrom(memoise,forget)
importFrom(nat,as.im3d)
importFrom(nat,boundingbox)
importFrom(nat,origin)
importFrom(nat,pointsinside)
importFrom(nat,read.im3d)
importFrom(nat,voxdims)
importFrom(nat,xform)
importFrom(nat,xyzmatrix)
importFrom(rappdirs,user_data_dir)
importFrom(rgl,as.mesh3d)
importFrom(rgl,persp3d)
importFrom(rgl,plot3d)
# Generated by roxygen2: do not edit by hand

S3method(as.character,templatebrain)
S3method(as.im3d,templatebrain)
S3method(as.templatebrain,character)
S3method(as.templatebrain,im3d)
S3method(as.templatebrain,templatebrain)
S3method(boundingbox,templatebrain)
S3method(dim,templatebrain)
S3method(display_slice,default)
S3method(display_slice,templatebrain)
S3method(origin,templatebrain)
S3method(plot3d,templatebrain)
S3method(print,templatebrain)
S3method(voxdims,templatebrain)
export("regtemplate<-")
export(add_reg_folders)
export(add_reglist)
export(all_templatebrains)
export(allreg_dataframe)
export(as.templatebrain)
export(bridging_graph)
export(bridging_sequence)
export(display_slice)
export(download_reg_repo)
export(extra_reg_folders)
export(fit_xform)
export(fit_xform_brain)
export(guess_templatebrain)
export(is.templatebrain)
export(local_reg_dir_for_url)
export(mirror_brain)
export(regtemplate)
export(shortest_bridging_seq)
export(templatebrain)
export(update_reg_repos)
export(xform_brain)
importFrom(digest,digest)
importFrom(igraph,"E<-")
importFrom(igraph,E)
importFrom(igraph,get.shortest.paths)
importFrom(igraph,graph.edgelist)
importFrom(igraph,shortest.paths)
importFrom(igraph,vertex_attr)
importFrom(memoise,forget)
importFrom(nat,as.im3d)
importFrom(nat,boundingbox)
importFrom(nat,origin)
importFrom(nat,pointsinside)
importFrom(nat,read.im3d)
importFrom(nat,voxdims)
importFrom(nat,xform)
importFrom(nat,xyzmatrix)
importFrom(rappdirs,user_data_dir)
importFrom(rgl,as.mesh3d)
importFrom(rgl,persp3d)
importFrom(rgl,plot3d)
59 changes: 30 additions & 29 deletions R/display_slice.R
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
#' Display an image slice in 3D
#'
#' @param brain template brain (e.g. IS2) of the slice.
#' @param slice Path to PNG image containing slice to display.
#' @param ... extra arguments to pass to \code{\link[rgl]{persp3d}}.
#' @export
display_slice <- function(brain, slice, ...) {
UseMethod("display_slice")
}

#' @method display_slice default
display_slice.default <- function(brain, slice, ...) {
}

#' @importFrom rgl persp3d
#' @method display_slice templatebrain
#' @export
display_slice.templatebrain <- function(brain, slice, z=NULL, ...) {
bbox <- brain$BoundingBox

x <- c(bbox[1, 1], bbox[2, 1])
y <- c(bbox[1, 2], bbox[2, 2])
if(is.null(z)) {
z <- (bbox[2, 3] - bbox[1, 3]) / 2
}
z <- matrix(rep(z, 4), nrow=2)

persp3d(x,y,z, col='white', specular='black', texture=slice, xlab='', ylab='', zlab='', box=F, axes=F, add=T, ...)
}
#' Display an image slice in 3D
#'
#' @param brain template brain (e.g. IS2) of the slice.
#' @param slice Path to PNG image containing slice to display.
#' @param ... extra arguments to pass to \code{\link[rgl]{persp3d}}.
#' @export
display_slice <- function(brain, slice, ...) {
UseMethod("display_slice")
}

#' @method display_slice default
#' @export
display_slice.default <- function(brain, slice, ...) {
}

#' @importFrom rgl persp3d
#' @method display_slice templatebrain
#' @export
display_slice.templatebrain <- function(brain, slice, z=NULL, ...) {
bbox <- brain$BoundingBox

x <- c(bbox[1, 1], bbox[2, 1])
y <- c(bbox[1, 2], bbox[2, 2])
if(is.null(z)) {
z <- (bbox[2, 3] - bbox[1, 3]) / 2
}
z <- matrix(rep(z, 4), nrow=2)

persp3d(x,y,z, col='white', specular='black', texture=slice, xlab='', ylab='', zlab='', box=F, axes=F, add=T, ...)
}

0 comments on commit 58b2de2

Please sign in to comment.