Skip to content

Commit

Permalink
add min_nucleus_size as a parameter for filtering out smaller objects
Browse files Browse the repository at this point in the history
  • Loading branch information
buddekai committed Jan 4, 2023
1 parent e465adb commit 64348e3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: cellPixels
Type: Package
Title: Detect nuclei (and cells) and count pixel intensities in these regions
Version: 0.2.9
Version: 0.2.10
Author: c(person("Kai", "Budde", email = "kai.budde@uni-rostock.de",
role = c("aut", "cre"))
Maintainer: Kai Budde <kai.budde@uni-rostock.de>
Expand Down
10 changes: 9 additions & 1 deletion R/cellPixels.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#' @param apotome A boolean (TRUE if Apotome was used)
#' @param apotome_section A boolean (TRUE is sectioned image shall be used)
#' @param nucleus_color A character (color (layer) of nuclei)
#' @param min_nucleus_size A number (minimum size in pixels of nuclei to be kept)
#' @param protein_in_nuc_color A character (color (layer) of protein
#' expected in nucleus)
#' @param protein_in_cytosol_color A character (color (layer) of protein
Expand Down Expand Up @@ -40,6 +41,7 @@ cellPixels <- function(input_dir = NULL,
apotome = FALSE,
apotome_section = FALSE,
nucleus_color = "blue",
min_nucleus_size = NULL,
protein_in_nuc_color = "none",
protein_in_cytosol_color = "none",
protein_in_membrane_color = "none",
Expand Down Expand Up @@ -776,7 +778,12 @@ cellPixels <- function(input_dir = NULL,
# barplot(table(nmask)[-1])

table_nmask <- table(nmask)
nuc_min_size <- 0.2*stats::median(table_nmask[-1])
if(is.null(min_nucleus_size)){
nuc_min_size <- 0.2*stats::median(table_nmask[-1])
}else{
nuc_min_size <- min_nucleus_size
}


# remove objects that are smaller than min_nuc_size
to_be_removed <- as.integer(names(which(table_nmask < nuc_min_size)))
Expand Down Expand Up @@ -1683,6 +1690,7 @@ cellPixels <- function(input_dir = NULL,
"apotome",
"apotome_section",
"nucleus_color",
"min_nucleus_size",
"protein_in_nuc_color",
"protein_in_cytosol_color",
"protein_in_membrane_color",
Expand Down
3 changes: 3 additions & 0 deletions man/cellPixels.Rd

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

0 comments on commit 64348e3

Please sign in to comment.