problem with watershed 3D segmentation

13 views (last 30 days)
MARIA RODRIGUEZ SANZ
MARIA RODRIGUEZ SANZ on 11 Jul 2018
Edited: raym on 6 Jan 2022
Hello!
I have a question related to 3D image segmentation (in order to obtain volume properties). I would like to segment a 3d grayscale image (of some structures in the nuclei of a cell). Watershed segmentation combined with imextended max (as shown in this example: https://blogs.mathworks.com/steve/2006/06/02/cell-segmentation/) yielded excellent results in each 2d "stack" of this 3d construction. Now, I want to implement the same procedure in order to analyse the 3D image (working with volume instead of surfaces). After several tests I have been able to create a nice object (I_mod) to undergo watershed segmentation (the equivalent 3D object that I use in 2D analyses). Unfortunately, to my despair, applying watershed to my object results in a completely black 3d Image. Does anybody have an idea of what's happening?? :(. Wy is this not working with 3D? I have also attached the I_mod object, wich can be visualized by: implay(I_mod,2);
Here is my syntax:
---------------------------------------------------------------------------------
if true
% code
%CREATE A 3D OBJECT FROM 2D IMAGES:
image3d= data{1,4}{2,1}{1,1};
for i=3:2:length(data{1,4}{2,1})
image3d=cat(3,image3d,data{1,4}{2,1}{i});
end
%FILTER AND BINARIZE 3D IMAGE
filt=medfilt3(image3d);
filt=imclose(filt, ones(5,5));
T = graythresh(filt);
bw_3d = imbinarize(filt,T);
%OBTAIN PERIMETER OF THE BINARIZED 3D IMAGE
bw_perim = bwperim(bw_3d);
%FIND IMEXTENDED OF EACH ORIGINAL 2D IMAGES:
peaks={}
for i=1:2:length(data{1,4}{2,1})
aj=imadjust(data{1,4}{2,1}{i},[0.3 1],[0 1]);
mask_em = imextendedmax(aj,9000);
SE = strel('disk', 3)
mask_em_dil=imdilate(mask_em,SE);
peaks=[peaks,mask_em_dil];
end
%3D RECONSTRUCTION OF PEAKS
peaks3d= peaks{1};
for i=2:length(peaks)
peaks3d=cat(3,peaks3d,peaks{i});
end
%OBTAIN COMPLEMENT IMAGE IN 3D
I_eq_c = imcomplement(image3d);
%Modify the image so that the background pixels and the extended maxima pixels are forced to be the only local minima in the image.
I_mod = imimposemin(I_eq_c, ~bw_3d | picos3d);
implay(I_mod,2); %The object here is really nice to undergo watershed transformation (as far as I know).
%APPLY WATERSHED TRANSFORMATION
L = watershed(I_mod);
implay(L,2); %the video shows a completely black 3d resut. (no segments)
Thank you vety much in advance!
Maria
  1 Comment
XF
XF on 17 Apr 2019
Hi, have you solved thie problem? I have the same problem with you now, after (3d)watershed, when I impaly it , it is all black too. Could you please tell me how to solve this? Thank you !

Sign in to comment.

Answers (1)

raym
raym on 6 Jan 2022
Edited: raym on 6 Jan 2022
max(max(max(L))) is 5, which means there are already 5 cells detected.
you can play like this :
implay(L*40,2)
the display range is 255, so the 5 is too dark to see.
The image is not so nice because the core is not clearly isolated, they are heavily connected,
The isolated white dots that located far away are also discard because there is no affiliated core for them

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!