Skip to content
Snippets Groups Projects

Update auto_crop.R

Closed Wayne Crismani requested to merge (removed):wcrismani-master-patch-00495 into master
+ 6
3
@@ -121,12 +121,14 @@ keep_cells <- function(candidate){
# delete everything that's too small
colorimg<- colorLabels(candidate, normalize = TRUE)
x <- computeFeatures.shape(candidate)
x <- computeFeatures.shape(candidate) # uses function from ebimage. give output kind of related to how circular the object is, size, perimeter, radius average etc
x <- data.frame(x)
OOI <- width(x)
OOI <- width(x) #Object Of Interest
counter <- 0
removed <- candidate
# loops over each Object of Interest (OOI)
while(counter<OOI){
counter <- counter+1
pixel_area = x$s.area[counter]
@@ -146,7 +148,7 @@ keep_cells <- function(candidate){
return(removed)
}
# function to help not count the same object twice
crop_single_object <- function(removed, OOI_final,counter_final,img_orig,img_orig_foci,file,cell_count){
tmp_img <- removed
## have a single object
@@ -163,6 +165,7 @@ crop_single_object <- function(removed, OOI_final,counter_final,img_orig,img_ori
}
# put nucleus mask on original image of the axis-marker or foci channel. matrix stuff which crops it to a square
## function: remove noise
noise_gone <- bwlabel(tmp_img)*as.matrix(img_orig)
noise_gone_foci <- bwlabel(tmp_img)*as.matrix(img_orig_foci)
Loading