Skip to content

Commit

Permalink
Change edge variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakob Russel committed Jan 16, 2018
1 parent 4882a06 commit 2826e53
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions R/clumps.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#' @param naming Optional. Add metadata to the output dataframe by looking through names of array files. Should be a list of character vectors, each list element will be added as a variable. Example: naming=list(Time=c("T0","T1","T2")). The function inserts a variable called Time, and then looks through the names of the array files and inserts characters mathcing either T0, T1 or T2
#' @param coords Logical. Return coordinates of the centroids of each aggregate. This can be somewhat time-consuming if there are many aggregates
#' @keywords array image aggregate
#' @return A list with two parts. First part is a dataframe with ID, size of aggregates in pixels, size of aggregates in microns if pwidth and zstep are provided, coordinates if coords is TRUE, if coords is TRUE also a logical variable, Edge, indicating whether the aggregate touches the edge, and name of image. Second part is a list of the arrays in which pixels are NA if empty or given a number indicating the aggregate ID
#' @return A list with two parts. First part is a dataframe with ID, size of aggregates in pixels, size of aggregates in microns if pwidth and zstep are provided, coordinates if coords is TRUE, if coords is TRUE also a variable, Edge, indicating how many pixels of each aggregate is on the edge of the image, and name of image. Second part is a list of the arrays in which pixels are NA if empty or given a number indicating the aggregate ID
#' @import mmand
#' @export

Expand Down Expand Up @@ -73,9 +73,9 @@ clumps <- function(imgs,channel,kern.neighbour=c(3,3,3),type.neighbour="box",ker
edge.y <- c(1,dim(ch_agg)[2])
edge.z <- c(1,dim(ch_agg)[3])

touch <- sapply(coordsl, function(ac) any(any(sapply(ac[,1], function(x) x %in% edge.x)),
any(sapply(ac[,2], function(x) x %in% edge.y)),
any(sapply(ac[,3], function(x) x %in% edge.z))))
touch <- sapply(coordsl, function(ac) sum(sum(sapply(ac[,1], function(x) x %in% edge.x)),
sum(sapply(ac[,2], function(x) x %in% edge.y)),
sum(sapply(ac[,3], function(x) x %in% edge.z))))

afr$Edge <- touch
}
Expand Down
2 changes: 1 addition & 1 deletion man/clumps.Rd

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

0 comments on commit 2826e53

Please sign in to comment.