Skip to content
Snippets Groups Projects
Commit cf2e5b6d authored by Wayne Crismani's avatar Wayne Crismani
Browse files

Update auto_crop.R

parent 934bfa11
No related branches found
No related tags found
1 merge request!1Update auto_crop.R
This commit is part of merge request !1. Comments created here will be created in the context of that merge request.
...@@ -121,12 +121,14 @@ keep_cells <- function(candidate){ ...@@ -121,12 +121,14 @@ keep_cells <- function(candidate){
# delete everything that's too small # delete everything that's too small
colorimg<- colorLabels(candidate, normalize = TRUE) 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) x <- data.frame(x)
OOI <- width(x) OOI <- width(x) #Object Of Interest
counter <- 0 counter <- 0
removed <- candidate removed <- candidate
# loops over each Object of Interest (OOI)
while(counter<OOI){ while(counter<OOI){
counter <- counter+1 counter <- counter+1
pixel_area = x$s.area[counter] pixel_area = x$s.area[counter]
...@@ -146,7 +148,7 @@ keep_cells <- function(candidate){ ...@@ -146,7 +148,7 @@ keep_cells <- function(candidate){
return(removed) 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){ crop_single_object <- function(removed, OOI_final,counter_final,img_orig,img_orig_foci,file,cell_count){
tmp_img <- removed tmp_img <- removed
## have a single object ## have a single object
...@@ -163,6 +165,7 @@ crop_single_object <- function(removed, OOI_final,counter_final,img_orig,img_ori ...@@ -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 ## function: remove noise
noise_gone <- bwlabel(tmp_img)*as.matrix(img_orig) noise_gone <- bwlabel(tmp_img)*as.matrix(img_orig)
noise_gone_foci <- bwlabel(tmp_img)*as.matrix(img_orig_foci) noise_gone_foci <- bwlabel(tmp_img)*as.matrix(img_orig_foci)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment