Commit 221b2aa9 authored by Lucy McNeill's avatar Lucy McNeill
Browse files

checks that number of objects is > 0 before plotting blobs to avoid vector memory exhausted error

parent 4daea0fd
......@@ -437,13 +437,20 @@ keep_cells <- function(candidate, max_cell_area, min_cell_area, cell_aspect_rati
if(annotation == "on"){
cat("\n displaying the retained cells in mask (correct size/ shape)")
if(crowded_cells == "TRUE"){
plot(colorLabels(retained))
tryCatch({
if(nrow(retained > 0)){
plot(colorLabels(retained))
}
},
error = function(e) {
}
)
}
else{
plot(retained)
}
}
retained <- bwlabel(retained)
return(retained)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment