Finding the regions automatically

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

Finding the regions automatically

anusuya pal
Hello,

Greetings of the day!

I have a binary image, and want to find the area of each of the domains. I
can do that with nearest neighbor tool by selecting each domain and to add
in roiManager, and then to measure the area of each domain.

I want to know is there any other way so that the selection of the domains
can be done automatically?

For convenience, attaching the binary image (a_75) and the output image
obtained from nearest neighbor tool showing one domain in red color. Your
help will be appreciated!

Thanks in advance!
Anu

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

a_75.jpg (656K) Download Attachment
output.jpg (685K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Finding the regions automatically

Herbie
Good day Anu,

here is an ImageJ-macro that does what you want for the provided sample
image:

//// macro start
run("Set Measurements...", "area redirect=None decimal=9");
setOption("BlackBackground", false);
run("Make Binary");
run("Dilate");
doWand(0, 1140);
run("Make Inverse");
run("Set...", "value=255");
run("Select None");
run("Invert LUT");
run("Analyze Particles...", "  show=Nothing display clear include add");
run("Measure");
exit();
//// macro end

Paste the above macro code to an empty macro window (Plugins >> New >>
Macro) and run it.

The results table lists 203 areas with size in pixels^2.

HTH

Herbie

:::::::::::::::::::::::::::::::::::::::::
Am 15.02.18 um 23:33 schrieb anusuya pal:

> Hello,
>
> Greetings of the day!
>
> I have a binary image, and want to find the area of each of the domains. I
> can do that with nearest neighbor tool by selecting each domain and to add
> in roiManager, and then to measure the area of each domain.
>
> I want to know is there any other way so that the selection of the domains
> can be done automatically?
>
> For convenience, attaching the binary image (a_75) and the output image
> obtained from nearest neighbor tool showing one domain in red color. Your
> help will be appreciated!
>
> Thanks in advance!
> Anu
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Finding the regions automatically

Jeremy Adler-2
In reply to this post by anusuya pal
Anu
Try this simple macro that works on the current image
Or do the sequence by hand


1) make binary, the original is not a binary image
2) join broken connections     Process/Binary/Options/closing      you may want to change the number of iterations    
3) threshold again and then use analyze particles to measure the area and place this in the results window. Analyze/set measurements decides what to measure


setAutoThreshold("Default dark");
setOption("BlackBackground", true);
run("Convert to Mask");
// join broken connections
run("Options...", "iterations=4 count=1 black do=Close");
setAutoThreshold("Default");

run("Set Measurements...", "area area_fraction redirect=None decimal=4");
run("Analyze Particles...", "display exclude clear summarize add");
run("Analyze Particles...", "exclude summarize add");

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of anusuya pal
Sent: den 15 februari 2018 23:34
To: [hidden email]
Subject: Finding the regions automatically

Hello,

Greetings of the day!

I have a binary image, and want to find the area of each of the domains. I can do that with nearest neighbor tool by selecting each domain and to add in roiManager, and then to measure the area of each domain.

I want to know is there any other way so that the selection of the domains can be done automatically?

For convenience, attaching the binary image (a_75) and the output image obtained from nearest neighbor tool showing one domain in red color. Your help will be appreciated!

Thanks in advance!
Anu

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Finding the regions automatically

Michael Schmid
In reply to this post by anusuya pal
Hi Anu,

Can't you simply run 'Analyze Particles'?
Make sure you have the checkmark for 'Exclude on Edges' on.


Michael
________________________________________________________________


On 15/02/2018 23:33, anusuya pal wrote:

> Hello,
>
> Greetings of the day!
>
> I have a binary image, and want to find the area of each of the domains. I
> can do that with nearest neighbor tool by selecting each domain and to add
> in roiManager, and then to measure the area of each domain.
>
> I want to know is there any other way so that the selection of the domains
> can be done automatically?
>
> For convenience, attaching the binary image (a_75) and the output image
> obtained from nearest neighbor tool showing one domain in red color. Your
> help will be appreciated!
>
> Thanks in advance!
> Anu

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Finding the regions automatically

anusuya pal
In reply to this post by anusuya pal
Hello everyone,

Thanks for giving me different suggestions.

Replying to Michael's question, Can't you simply run 'Analyze Particles'? I
think I can't just do it, to get the accurate results, I need to do some
work before we just use 'analyze particles'. If I do so on the raw image,
there are some lines which are not perfectly continuous, there are gaps,
and if I just do analyze particles, it takes some of the gaps as particles
and count the area, which I think is not correct. However I did this and
got sum of the areas as 499130 pixel^2 with counts 633.

Replying to Cammer's suggestion, Threshold, Erode,Analyze, if I erode, yes,
the lines will be perfectly continuous, but the lines become thicker, I
should do to make those lines thin again, otherwise the areas of the
domains are not perfect. However, I did this, I got the count as 211 and
sum as 580561.

Now, comes to Herbie's and Jeremy's approaches. Herbie's approach gives
counts as 207 with sum as 425532 and Jeremy's macro gives 186 with 495383
pixel^2. The image has so many domains that I can't check manually, may I
know what to do? Is there any way to check that the total area of domains
are almost perfect?

Thanks
Anu






On Fri, Feb 16, 2018 at 10:00 AM, Cammer, Michael <
[hidden email]> wrote:

> Theshold
> Erode
> Analyze particles
>
> Michael Cammer, Sr Research Scientist, DART Microscopy Laboratory
> NYU Langone Health, 540 First Avenue, SK2 Microscopy Suite, New York, NY
> 10016
> C: 914-309-3270  [hidden email]  http://nyulmc.org/micros
> http://microscopynotes.com/
>
>
>
> -----Original Message-----
> From: anusuya pal [mailto:[hidden email]]
> Sent: Thursday, February 15, 2018 5:34 PM
> To: [hidden email]
> Subject: Finding the regions automatically
>
> Hello,
>
> Greetings of the day!
>
> I have a binary image, and want to find the area of each of the domains. I
> can do that with nearest neighbor tool by selecting each domain and to add
> in roiManager, and then to measure the area of each domain.
>
> I want to know is there any other way so that the selection of the domains
> can be done automatically?
>
> For convenience, attaching the binary image (a_75) and the output image
> obtained from nearest neighbor tool showing one domain in red color. Your
> help will be appreciated!
>
> Thanks in advance!
> Anu
>
> --
> ImageJ mailing list: https://urldefense.proofpoint.
> com/v2/url?u=http-3A__imagej.nih.gov_ij_list.html&d=DwIBaQ&c=
> j5oPpO0eBH1iio48DtsedbOBGmuw5jHLjgvtN2r4ehE&r=oU_05LztNstAydlbm5L5GDu_
> vAdjXk3frDLx_CqKkuo&m=0scoKp6fl_R9-qutLEZ5x7fGgj5l1YwTIh0rmldWvRQ&s=
> akwKRbFGKKE9JTAkKQOcFLervrj_pvDupyJHL88E8_U&e=
>
> ------------------------------------------------------------
> This email message, including any attachments, is for the sole use of the
> intended recipient(s) and may contain information that is proprietary,
> confidential, and exempt from disclosure under applicable law. Any
> unauthorized review, use, disclosure, or distribution is prohibited. If you
> have received this email in error please notify the sender by return email
> and delete the original message. Please note, the recipient should check
> this email and any attachments for the presence of viruses. The
> organization accepts no liability for any damage caused by any virus
> transmitted by this email.
> =================================
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Finding the regions automatically

Herbie
Good day,

as I wrote before, my macro gives exactly and reproducibly 203 (not 207
as you write) areas for the provided sample image, where the last is the
space around the disc.

Of course you must decide if an area is too small to be counted and
correspondingly enter this value to the Analyze Particles dialog.

"The image has so many domains that I can't check manually, may I
know what to do? Is there any way to check that the total area of
domains are almost perfect?"

If counting about 200 areas by hand is too much for you, then you have
to live with what you get. If you dilate or erode differently, you will
get different results. You have to decide what's acceptable for you.

Most importantly, you should perfectly understand what the proposed
macros are doing.

Regards

Herbie

:::::::::::::::::::::::::::::::::::::::::
Am 17.02.18 um 02:56 schrieb anusuya pal:

> Hello everyone,
>
> Thanks for giving me different suggestions.
>
> Replying to Michael's question, Can't you simply run 'Analyze Particles'? I
> think I can't just do it, to get the accurate results, I need to do some
> work before we just use 'analyze particles'. If I do so on the raw image,
> there are some lines which are not perfectly continuous, there are gaps,
> and if I just do analyze particles, it takes some of the gaps as particles
> and count the area, which I think is not correct. However I did this and
> got sum of the areas as 499130 pixel^2 with counts 633.
>
> Replying to Cammer's suggestion, Threshold, Erode,Analyze, if I erode, yes,
> the lines will be perfectly continuous, but the lines become thicker, I
> should do to make those lines thin again, otherwise the areas of the
> domains are not perfect. However, I did this, I got the count as 211 and
> sum as 580561.
>
> Now, comes to Herbie's and Jeremy's approaches. Herbie's approach gives
> counts as 207 with sum as 425532 and Jeremy's macro gives 186 with 495383
> pixel^2. The image has so many domains that I can't check manually, may I
> know what to do? Is there any way to check that the total area of domains
> are almost perfect?
>
> Thanks
> Anu
>
>
>
>
>
>
> On Fri, Feb 16, 2018 at 10:00 AM, Cammer, Michael <
> [hidden email]> wrote:
>
>> Theshold
>> Erode
>> Analyze particles
>>
>> Michael Cammer, Sr Research Scientist, DART Microscopy Laboratory
>> NYU Langone Health, 540 First Avenue, SK2 Microscopy Suite, New York, NY
>> 10016
>> C: 914-309-3270  [hidden email]  http://nyulmc.org/micros
>> http://microscopynotes.com/
>>
>>
>>
>> -----Original Message-----
>> From: anusuya pal [mailto:[hidden email]]
>> Sent: Thursday, February 15, 2018 5:34 PM
>> To: [hidden email]
>> Subject: Finding the regions automatically
>>
>> Hello,
>>
>> Greetings of the day!
>>
>> I have a binary image, and want to find the area of each of the domains. I
>> can do that with nearest neighbor tool by selecting each domain and to add
>> in roiManager, and then to measure the area of each domain.
>>
>> I want to know is there any other way so that the selection of the domains
>> can be done automatically?
>>
>> For convenience, attaching the binary image (a_75) and the output image
>> obtained from nearest neighbor tool showing one domain in red color. Your
>> help will be appreciated!
>>
>> Thanks in advance!
>> Anu
>>
>> --
>> ImageJ mailing list: https://urldefense.proofpoint.
>> com/v2/url?u=http-3A__imagej.nih.gov_ij_list.html&d=DwIBaQ&c=
>> j5oPpO0eBH1iio48DtsedbOBGmuw5jHLjgvtN2r4ehE&r=oU_05LztNstAydlbm5L5GDu_
>> vAdjXk3frDLx_CqKkuo&m=0scoKp6fl_R9-qutLEZ5x7fGgj5l1YwTIh0rmldWvRQ&s=
>> akwKRbFGKKE9JTAkKQOcFLervrj_pvDupyJHL88E8_U&e=
>>
>> ------------------------------------------------------------
>> This email message, including any attachments, is for the sole use of the
>> intended recipient(s) and may contain information that is proprietary,
>> confidential, and exempt from disclosure under applicable law. Any
>> unauthorized review, use, disclosure, or distribution is prohibited. If you
>> have received this email in error please notify the sender by return email
>> and delete the original message. Please note, the recipient should check
>> this email and any attachments for the presence of viruses. The
>> organization accepts no liability for any damage caused by any virus
>> transmitted by this email.
>> =================================
>>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Finding the regions automatically

Michael Schmid
In reply to this post by anusuya pal
Hi Anu,

if you want to close the gaps in the lines, you can try
Process>Binary>Watershed. It will create some extra lines from the
cricumference to the border, but they should not hurt.

Of course, this will change the number of total pixels (the newly drawn
lines won't be part of your domains any more), but if the missing line
segments were ther, it would probably change the number of pixels even
more.


Michael
________________________________________________________________


On 2018-02-17 02:56, anusuya pal wrote:

> Hello everyone,
>
> Thanks for giving me different suggestions.
>
> Replying to Michael's question, Can't you simply run 'Analyze
> Particles'? I
> think I can't just do it, to get the accurate results, I need to do
> some
> work before we just use 'analyze particles'. If I do so on the raw
> image,
> there are some lines which are not perfectly continuous, there are
> gaps,
> and if I just do analyze particles, it takes some of the gaps as
> particles
> and count the area, which I think is not correct. However I did this
> and
> got sum of the areas as 499130 pixel^2 with counts 633.
>
> Replying to Cammer's suggestion, Threshold, Erode,Analyze, if I erode,
> yes,
> the lines will be perfectly continuous, but the lines become thicker, I
> should do to make those lines thin again, otherwise the areas of the
> domains are not perfect. However, I did this, I got the count as 211
> and
> sum as 580561.
>
> Now, comes to Herbie's and Jeremy's approaches. Herbie's approach gives
> counts as 207 with sum as 425532 and Jeremy's macro gives 186 with
> 495383
> pixel^2. The image has so many domains that I can't check manually, may
> I
> know what to do? Is there any way to check that the total area of
> domains
> are almost perfect?
>
> Thanks
> Anu
>
>
>
>
>
>
> On Fri, Feb 16, 2018 at 10:00 AM, Cammer, Michael <
> [hidden email]> wrote:
>
>> Theshold
>> Erode
>> Analyze particles
>>
>> Michael Cammer, Sr Research Scientist, DART Microscopy Laboratory
>> NYU Langone Health, 540 First Avenue, SK2 Microscopy Suite, New York,
>> NY
>> 10016
>> C: 914-309-3270  [hidden email]  http://nyulmc.org/micros
>> http://microscopynotes.com/
>>
>>
>>
>> -----Original Message-----
>> From: anusuya pal [mailto:[hidden email]]
>> Sent: Thursday, February 15, 2018 5:34 PM
>> To: [hidden email]
>> Subject: Finding the regions automatically
>>
>> Hello,
>>
>> Greetings of the day!
>>
>> I have a binary image, and want to find the area of each of the
>> domains. I
>> can do that with nearest neighbor tool by selecting each domain and to
>> add
>> in roiManager, and then to measure the area of each domain.
>>
>> I want to know is there any other way so that the selection of the
>> domains
>> can be done automatically?
>>
>> For convenience, attaching the binary image (a_75) and the output
>> image
>> obtained from nearest neighbor tool showing one domain in red color.
>> Your
>> help will be appreciated!
>>
>> Thanks in advance!
>> Anu
>>
>> --
>> ImageJ mailing list: https://urldefense.proofpoint.
>> com/v2/url?u=http-3A__imagej.nih.gov_ij_list.html&d=DwIBaQ&c=
>> j5oPpO0eBH1iio48DtsedbOBGmuw5jHLjgvtN2r4ehE&r=oU_05LztNstAydlbm5L5GDu_
>> vAdjXk3frDLx_CqKkuo&m=0scoKp6fl_R9-qutLEZ5x7fGgj5l1YwTIh0rmldWvRQ&s=
>> akwKRbFGKKE9JTAkKQOcFLervrj_pvDupyJHL88E8_U&e=
>>
>> ------------------------------------------------------------
>> This email message, including any attachments, is for the sole use of
>> the
>> intended recipient(s) and may contain information that is proprietary,
>> confidential, and exempt from disclosure under applicable law. Any
>> unauthorized review, use, disclosure, or distribution is prohibited.
>> If you
>> have received this email in error please notify the sender by return
>> email
>> and delete the original message. Please note, the recipient should
>> check
>> this email and any attachments for the presence of viruses. The
>> organization accepts no liability for any damage caused by any virus
>> transmitted by this email.
>> =================================
>>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Finding the regions automatically

anusuya pal
Thanks for the suggestions!

Anu

On Sat, Feb 17, 2018 at 11:02 AM, Michael Schmid <[hidden email]>
wrote:

> Hi Anu,
>
> if you want to close the gaps in the lines, you can try
> Process>Binary>Watershed. It will create some extra lines from the
> cricumference to the border, but they should not hurt.
>
> Of course, this will change the number of total pixels (the newly drawn
> lines won't be part of your domains any more), but if the missing line
> segments were ther, it would probably change the number of pixels even more.
>
>
> Michael
> ________________________________________________________________
>
>
>
> On 2018-02-17 02:56, anusuya pal wrote:
>
>> Hello everyone,
>>
>> Thanks for giving me different suggestions.
>>
>> Replying to Michael's question, Can't you simply run 'Analyze Particles'?
>> I
>> think I can't just do it, to get the accurate results, I need to do some
>> work before we just use 'analyze particles'. If I do so on the raw image,
>> there are some lines which are not perfectly continuous, there are gaps,
>> and if I just do analyze particles, it takes some of the gaps as particles
>> and count the area, which I think is not correct. However I did this and
>> got sum of the areas as 499130 pixel^2 with counts 633.
>>
>> Replying to Cammer's suggestion, Threshold, Erode,Analyze, if I erode,
>> yes,
>> the lines will be perfectly continuous, but the lines become thicker, I
>> should do to make those lines thin again, otherwise the areas of the
>> domains are not perfect. However, I did this, I got the count as 211 and
>> sum as 580561.
>>
>> Now, comes to Herbie's and Jeremy's approaches. Herbie's approach gives
>> counts as 207 with sum as 425532 and Jeremy's macro gives 186 with 495383
>> pixel^2. The image has so many domains that I can't check manually, may I
>> know what to do? Is there any way to check that the total area of domains
>> are almost perfect?
>>
>> Thanks
>> Anu
>>
>>
>>
>>
>>
>>
>> On Fri, Feb 16, 2018 at 10:00 AM, Cammer, Michael <
>> [hidden email]> wrote:
>>
>> Theshold
>>> Erode
>>> Analyze particles
>>>
>>> Michael Cammer, Sr Research Scientist, DART Microscopy Laboratory
>>> NYU Langone Health, 540 First Avenue, SK2 Microscopy Suite, New York, NY
>>> 10016
>>> C: 914-309-3270  [hidden email]  http://nyulmc.org/micros
>>> http://microscopynotes.com/
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: anusuya pal [mailto:[hidden email]]
>>> Sent: Thursday, February 15, 2018 5:34 PM
>>> To: [hidden email]
>>> Subject: Finding the regions automatically
>>>
>>> Hello,
>>>
>>> Greetings of the day!
>>>
>>> I have a binary image, and want to find the area of each of the domains.
>>> I
>>> can do that with nearest neighbor tool by selecting each domain and to
>>> add
>>> in roiManager, and then to measure the area of each domain.
>>>
>>> I want to know is there any other way so that the selection of the
>>> domains
>>> can be done automatically?
>>>
>>> For convenience, attaching the binary image (a_75) and the output image
>>> obtained from nearest neighbor tool showing one domain in red color. Your
>>> help will be appreciated!
>>>
>>> Thanks in advance!
>>> Anu
>>>
>>> --
>>> ImageJ mailing list: https://urldefense.proofpoint.
>>> com/v2/url?u=http-3A__imagej.nih.gov_ij_list.html&d=DwIBaQ&c=
>>> j5oPpO0eBH1iio48DtsedbOBGmuw5jHLjgvtN2r4ehE&r=oU_05LztNstAydlbm5L5GDu_
>>> vAdjXk3frDLx_CqKkuo&m=0scoKp6fl_R9-qutLEZ5x7fGgj5l1YwTIh0rmldWvRQ&s=
>>> akwKRbFGKKE9JTAkKQOcFLervrj_pvDupyJHL88E8_U&e=
>>>
>>> ------------------------------------------------------------
>>> This email message, including any attachments, is for the sole use of the
>>> intended recipient(s) and may contain information that is proprietary,
>>> confidential, and exempt from disclosure under applicable law. Any
>>> unauthorized review, use, disclosure, or distribution is prohibited. If
>>> you
>>> have received this email in error please notify the sender by return
>>> email
>>> and delete the original message. Please note, the recipient should check
>>> this email and any attachments for the presence of viruses. The
>>> organization accepts no liability for any damage caused by any virus
>>> transmitted by this email.
>>> =================================
>>>
>>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html