MATLAB Answers

De Ar
0

Threshold for a numeric matrix (with negative values) representing a cell colony image

Asked by De Ar
on 9 Sep 2019
Latest activity Edited by De Ar
on 9 Sep 2019
I have a numeric matrix, processed from an image of cell colonies, with values outside of the range [0,1], including negative values. I am trying to find an appropriate threshold to binarize the "blob" colonies for further segmentation. Here I have found an adequate threshold at pixel value 10. However, as I have multiple matrices like that, this selected threshold does not work on all matrices due to some of the blobs are represented as negative extremas in some matrices. How can I estimate a correct, individualized threshold for each single matrix that binarizes the colonies? Should this be viewed as "topographical" map to find a mean estimate of all the baselines of the local maximas (or eventually local minimas)?
Thanks in advance for any input!
Attempt
struct = load('matrix_colonies.mat');
matrix_colonies = struct.matrix_colonies;
figure(); imshow(matrix_colonies, [])
%%%% This segment should be improved. A "generalized" theshold should be estimated
matrix_colonies(matrix_colonies <= 10) = 0;
%%%%
%% Binarize
bw_colonies = matrix_colonies > 0;
se = strel('disk', 5);
bw_colonies = bwmorph(bw_colonies, 'bridge', Inf);
bw_colonies = imclearborder(bw_colonies, 8);
bw_colonies = bwmorph(bw_colonies, 'clean', Inf);
bw_colonies = imfill(bw_colonies, 'holes');
bw_colonies = imopen(bw_colonies, se); % remove disk shaped structures with radius less than 5 pixels
bw_colonies = bwareaopen(bw_colonies, 120); % remove objects containing fewer than 120 pixels
%% Plot
figure(); imshow(bw_colonies)

  0 Comments

Sign in to comment.

0 Answers