-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feature/npop3d: Add test for npop3d Add npop3d and teach to plot3d.neuronlist to prepare for it Make .plotted3d environment on startup * part of fix for natverse/flycircuit#11
- Loading branch information
Showing
7 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#' Remove plotted neurons or other 3d objects | ||
#' | ||
#' The normal usage will not specify \code{x} in which case the last neurons | ||
#' plotted by \code{plot3d.neuronlist} or any of its friends will be removed. | ||
#' @param x rgl ids of objects to remove | ||
#' @param slow Whether to remove neurons one by one (slowly) default: FALSE | ||
#' @param type Type of objects to remove see \code{pop3d}. | ||
#' @export | ||
#' @seealso \code{\link[rgl]{pop3d}}, \code{\link{plot3d.neuronlist}} | ||
#' @importFrom rgl pop3d | ||
npop3d <- function(x, slow=FALSE, type='shapes') { | ||
if(missing(x)){ | ||
if(exists(".last.plot3d", envir=.plotted3d)) | ||
x <- get(".last.plot3d", envir=.plotted3d) | ||
else x <- NULL | ||
} | ||
if(slow) invisible(sapply(x, function(x) try(pop3d(x, type=type)))) | ||
else try(pop3d(unlist(x), type=type)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
% Generated by roxygen2 (4.0.1): do not edit by hand | ||
\name{npop3d} | ||
\alias{npop3d} | ||
\title{Remove plotted neurons or other 3d objects} | ||
\usage{ | ||
npop3d(x, slow = FALSE, type = "shapes") | ||
} | ||
\arguments{ | ||
\item{x}{rgl ids of objects to remove} | ||
|
||
\item{slow}{Whether to remove neurons one by one (slowly) | ||
default: FALSE} | ||
|
||
\item{type}{Type of objects to remove see \code{pop3d}.} | ||
} | ||
\description{ | ||
The normal usage will not specify \code{x} in which case | ||
the last neurons plotted by \code{plot3d.neuronlist} or any | ||
of its friends will be removed. | ||
} | ||
\seealso{ | ||
\code{\link[rgl]{pop3d}}, \code{\link{plot3d.neuronlist}} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
context("npop3d") | ||
|
||
test_that("pop last plotted neurons",{ | ||
open3d() | ||
original.rgl.ids=rgl.ids() | ||
plot3d(c("EBH11R", "EBH20L"), db=Cell07PNs) | ||
npop3d() | ||
expect_equal(rgl.ids(), original.rgl.ids) | ||
rgl.close() | ||
}) |