Watershed Question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Watershed Question

Sebastian Rhode-3
Hi,

I have an 16bit image with some stained cells and wrote I macro which
automatically detects the cells and converts them into a ROI. First I use
the RATS (treshold) plugin, which yields in in an 8bit BW image. And to
separate overlapping cells, I use "Watershed" from the Process/Binary menu.
This works fine.I end up with well separated ROIs, one for every cells,
after "Analysis particles".

But when I apply the same workflow to the same data on the PC of my
colleague, the watershed does not separate overlapping ROIs. There I end up
with the inverser result. The gaps in between the cells are now the output
after "Analysis particles", sinve the watershed did not separate the
regions. Instead they all got connected by lines.

So I think there must be an option concerning the "Watershed", which allows
me to control this behavior, but I have no idea, where to look for it. any
idea, what my mistake is?

Cheers,

Sebi
Reply | Threaded
Open this post in threaded view
|

Re: Watershed Question

Aryeh Weiss
On 5/24/11 10:34 AM, Sebastian Rhode wrote:

> Hi,
>
> I have an 16bit image with some stained cells and wrote I macro which
> automatically detects the cells and converts them into a ROI. First I use
> the RATS (treshold) plugin, which yields in in an 8bit BW image. And to
> separate overlapping cells, I use "Watershed" from the Process/Binary menu.
> This works fine.I end up with well separated ROIs, one for every cells,
> after "Analysis particles".
>
> But when I apply the same workflow to the same data on the PC of my
> colleague, the watershed does not separate overlapping ROIs. There I end up
> with the inverse result. The gaps in between the cells are now the output
> after "Analysis particles", sinve the watershed did not separate the
> regions. Instead they all got connected by lines.
>
> So I think there must be an option concerning the "Watershed", which allows
> me to control this behavior, but I have no idea, where to look for it. any
> idea, what my mistake is?
>
> Cheers,
>
> Sebi
>

Binary-->Options has a checkbox that allow you select black background.
This should solve your problem.

I add that I find the issue of black background vs white background in
ImageJ confusing. For example, the particle analyzer create a mask with
black objects on a white background, but it is actually an inverse LUT,
and really the objects are 255 and the background is zero. Yet sometimes
I run into a plugin that really wants a white background. I have not yet
sorted this out.

--aryeh
--
Aryeh Weiss
School of Engineering
Bar Ilan University
Ramat Gan 52900 Israel

Ph:  972-3-5317638
FAX: 972-3-7384051
Reply | Threaded
Open this post in threaded view
|

Re: Watershed Question

Sebastian Rhode-3
Thanks a lot. Now it works fine. I just added

run("Options...", "iterations=1 count=1 black edm=Overwrite");

to my code and now it works everywhere ...

Sebi

2011/5/24 Aryeh Weiss <[hidden email]>

> On 5/24/11 10:34 AM, Sebastian Rhode wrote:
>
>> Hi,
>>
>> I have an 16bit image with some stained cells and wrote I macro which
>> automatically detects the cells and converts them into a ROI. First I use
>> the RATS (treshold) plugin, which yields in in an 8bit BW image. And to
>> separate overlapping cells, I use "Watershed" from the Process/Binary
>> menu.
>> This works fine.I end up with well separated ROIs, one for every cells,
>> after "Analysis particles".
>>
>> But when I apply the same workflow to the same data on the PC of my
>> colleague, the watershed does not separate overlapping ROIs. There I end
>> up
>> with the inverse result. The gaps in between the cells are now the output
>>
>> after "Analysis particles", sinve the watershed did not separate the
>> regions. Instead they all got connected by lines.
>>
>> So I think there must be an option concerning the "Watershed", which
>> allows
>> me to control this behavior, but I have no idea, where to look for it. any
>> idea, what my mistake is?
>>
>> Cheers,
>>
>> Sebi
>>
>>
> Binary-->Options has a checkbox that allow you select black background.
> This should solve your problem.
>
> I add that I find the issue of black background vs white background in
> ImageJ confusing. For example, the particle analyzer create a mask with
> black objects on a white background, but it is actually an inverse LUT, and
> really the objects are 255 and the background is zero. Yet sometimes I run
> into a plugin that really wants a white background. I have not yet sorted
> this out.
>
> --aryeh
> --
> Aryeh Weiss
> School of Engineering
> Bar Ilan University
> Ramat Gan 52900 Israel
>
> Ph:  972-3-5317638
> FAX: 972-3-7384051
>
>


--
Dr. Sebastian Rhode
Grünwalder Str. 103a
81547 München
Tel: +49 89 4703091
Mobil: +49 15122810945
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Watershed Question

Gabriel Landini
In reply to this post by Aryeh Weiss
On Tuesday 24 May 2011 09:32:03 Aryeh Weiss wrote:
> Binary-->Options has a checkbox that allow you select black background.
> This should solve your problem.
>
> I add that I find the issue of black background vs white background in
> ImageJ confusing. For example, the particle analyzer create a mask with
> black objects on a white background, but it is actually an inverse LUT,
> and really the objects are 255 and the background is zero. Yet sometimes
> I run into a plugin that really wants a white background. I have not yet
> sorted this out.

I agree, this is confusing.  My approach to this is to tweak 2 places and
write recorded commands to the StartupMacros.txt file to make it work by
default as white objects on a black background.

One is the colour of the picker (so drawing and filling have the right value):
run("Colors...", "foreground=white background=black selection=yellow");

The other is the option of the binary operations (so the binary morphology
operations are correct):
run("Options...", "iterations=1 black pad edm=Overwrite count=1");

I find the inverted LUTs very confusing and I try to avoid them as further
results of processing binary operations between binary images -where one of
them has an inverted LUT- is most unintuitive.

Instead of using that inverted LUT mask from the particle analyzer I use:
Process>Binary>Convert to Mask, which respects the foreground and background
set colours (and has no inverted LUT).

Just remember to also provide the StartupMacros.txt file when exchanging
macros with another user or using a new install as otherwise one can
potentially end up with the inverted results.
I see no other solution than this at the moment.

Cheers
Gabriel