Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Watershed a 3D Stack

Subject: Watershed a 3D Stack

From: Steve

Date: 15 Dec, 2010 18:24:05

Message: 1 of 5

I saw that Matlab can do a 2D watershed and a 3D watershed. If I have a stack of 30, 800x800 images (ie. 800x800x30) and implement the watershed function, do you know if Matlab treats this as 30 separate 2D watershed commands or if it will automatically use the 3D watershed?

I'm trying to get a 3D watershed and do not know how Matlab will choose to watershed the 3D array.

Thanks.

Subject: Watershed a 3D Stack

From: Sean de

Date: 15 Dec, 2010 18:42:24

Message: 2 of 5

"Steve " <steven_hupcher@urmc.rochester.edu> wrote in message <ieb145$4g9$1@fred.mathworks.com>...
> I saw that Matlab can do a 2D watershed and a 3D watershed. If I have a stack of 30, 800x800 images (ie. 800x800x30) and implement the watershed function, do you know if Matlab treats this as 30 separate 2D watershed commands or if it will automatically use the 3D watershed?
>
> I'm trying to get a 3D watershed and do not know how Matlab will choose to watershed the 3D array.
>
> Thanks.

It will treat it as a 3D array since it is a 3D array and will do the 3D watershed.

Look at the 3D example in the help.

Subject: Watershed a 3D Stack

From: Steven

Date: 15 Dec, 2010 19:30:25

Message: 3 of 5

"Sean de " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <ieb26g$grs$1@fred.mathworks.com>...
> "Steve " <steven_hupcher@urmc.rochester.edu> wrote in message <ieb145$4g9$1@fred.mathworks.com>...
> > I saw that Matlab can do a 2D watershed and a 3D watershed. If I have a stack of 30, 800x800 images (ie. 800x800x30) and implement the watershed function, do you know if Matlab treats this as 30 separate 2D watershed commands or if it will automatically use the 3D watershed?
> >
> > I'm trying to get a 3D watershed and do not know how Matlab will choose to watershed the 3D array.
> >
> > Thanks.
>
> It will treat it as a 3D array since it is a 3D array and will do the 3D watershed.
>
> Look at the 3D example in the help.

Thanks for the help Sean. I have another watershed question though.

I followed the example in the Matlab documentation (here: http://www.mathworks.com/help/toolbox/images/ref/watershed.html) to watershed my stack of cells and it worked great. The only problem is that Matlab removed cells from my images. It appears random but it looks my watershed image is missing roughly a quarter of the cells that the original image had. Some of the cells were on there own without any neighboring cells touching it. I can't figure out why those cells just do not appear.

Is there any kind of filtering by size or shape that might remove some cells?

Has anyone else had this problem before? Thanks.

Subject: Watershed a 3D Stack

From: Sean de

Date: 15 Dec, 2010 19:59:07

Message: 4 of 5

"Steven " <steven_hupcher@urmc.rochester.edu> wrote in message
> Thanks for the help Sean. I have another watershed question though.
>
> I followed the example in the Matlab documentation (here: http://www.mathworks.com/help/toolbox/images/ref/watershed.html) to watershed my stack of cells and it worked great. The only problem is that Matlab removed cells from my images. It appears random but it looks my watershed image is missing roughly a quarter of the cells that the original image had. Some of the cells were on there own without any neighboring cells touching it. I can't figure out why those cells just do not appear.
>
> Is there any kind of filtering by size or shape that might remove some cells?
>
> Has anyone else had this problem before? Thanks.

I'm _assuming_ what's happening is your using the isosurface command with a poor isovalue.
doc isosurface
for detailed more information.

Basically everything below a certain threshold will not be rendered because it's below the isovalue you've selected. Try two things:
fv = isosurface(your_watershed_cell_stack,0); %note 0 as an isovalue!
patch(fv);

or try watching it directly with
implay(your_watershed_cell_stack);

Good Luck!
-Sean

Subject: Watershed a 3D Stack

From: Steven

Date: 15 Dec, 2010 20:26:05

Message: 5 of 5

"Sean de " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <ieb6ma$c5p$1@fred.mathworks.com>...
> "Steven " <steven_hupcher@urmc.rochester.edu> wrote in message
> > Thanks for the help Sean. I have another watershed question though.
> >
> > I followed the example in the Matlab documentation (here: http://www.mathworks.com/help/toolbox/images/ref/watershed.html) to watershed my stack of cells and it worked great. The only problem is that Matlab removed cells from my images. It appears random but it looks my watershed image is missing roughly a quarter of the cells that the original image had. Some of the cells were on there own without any neighboring cells touching it. I can't figure out why those cells just do not appear.
> >
> > Is there any kind of filtering by size or shape that might remove some cells?
> >
> > Has anyone else had this problem before? Thanks.
>
> I'm _assuming_ what's happening is your using the isosurface command with a poor isovalue.
> doc isosurface
> for detailed more information.
>
> Basically everything below a certain threshold will not be rendered because it's below the isovalue you've selected. Try two things:
> fv = isosurface(your_watershed_cell_stack,0); %note 0 as an isovalue!
> patch(fv);
>
> or try watching it directly with
> implay(your_watershed_cell_stack);
>
> Good Luck!
> -Sean

Thanks again. I was not completely clear and that's my fault.

I believe my problem is arising in the watershed algorithm itself. I'm following the example up to and including calling the watershed function. After I watershed my stack, I use the imshow command to look at one slice of the stack and compare it to the identical slice of my original image stack. That's where I'm noticing that the cells are missing. I wasn't actually using the isosurface command.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us