Calculating the area of one channel within an 'island' of a another channel

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

Calculating the area of one channel within an 'island' of a another channel

Angus G
Dear all,

Even if people don’t have a mechanism to achieve this it would be good to know if it is possible.

I invert my images, split them into three channels (RBG) and then threshold them. I then use watershed to break up the red channel data into ‘islands’ of particles. When I use ‘analyse particles’ each ‘island’ gets it’s own number and I can obtain the area in pixels of each of these. All’s good so far!

What I would like to be able to do is quantify the area of yellow pixels within each numbered ‘island’ of red pixels.

If anyone has any ideas or knows if this will not be possible I’d be really grateful if you could let me know. If it can be done it will change the way I gather data and would greatly improve the results!

Thanks for any help you can provide!
abg

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

Re: Calculating the area of one channel within an 'island' of a another channel

Stoyan Pavlov
Hi Angus,
*You may try adding the "Islands*" as RoIs to the RoIManager (simply by
running the particle analyzer with the add to manager option on)  and than
using a simple macro you may measure anything within each of the RoIs. I
used to do something similar  with the following macro:

/ This Macro counts particles inside specific Roi and otputs the number to
TAB separated Log window which after saving can be imported to excel.
print ("RoiNumber","    ","SliceLabel","    ","RoIName","    ","Count","
","RoIArea","    ","RoIPerimeter","    "," ParticlesCoveredArea","
","AreaFraction") ;
setAutoThreshold("Default dark");
 n = roiManager("count");
        for (i=0; i<n; i++)  {
        roiManager("select", i);
        run("Set Measurements...", "area perimeter redirect=None
decimal=4");
    run("Measure");
    r=getResult("Area");
    u=getResult("Perim.");
run("Set Measurements...", "area area_fraction limit display redirect=None
decimal=4");
run("Measure");
s=getResult("Area");
t=getResult("%Area");
run("Analyze Particles...", "size=0-infinity circularity=0.00-1.00
show=Nothing display clear ");
    m=nResults;
     q=getInfo("slice.label");
    print (i,"    ",q,"    ",call("ij.plugin.frame.RoiManager.getName",
i),"    ",m,"    ",r,"    ",u,"    ",s,"    ",t) ;
}

I hope this helps.

Stoyan


2013/7/3 Angus G <[hidden email]>

> Dear all,
>
> Even if people don’t have a mechanism to achieve this it would be good to
> know if it is possible.
>
> I invert my images, split them into three channels (RBG) and then
> threshold them. I then use watershed to break up the red channel data into
> ‘islands’ of particles. When I use ‘analyse particles’ each ‘island’ gets
> it’s own number and I can obtain the area in pixels of each of these. All’s
> good so far!
>
> What I would like to be able to do is quantify the area of yellow pixels
> within each numbered ‘island’ of red pixels.
>
> If anyone has any ideas or knows if this will not be possible I’d be
> really grateful if you could let me know. If it can be done it will change
> the way I gather data and would greatly improve the results!
>
> Thanks for any help you can provide!
> abg
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>



--
Dr. Stoyan P. Pavlov, MD, PhD
Departament of Anatomy, Histology and Embryology
Medical University "Prof. Dr. Paraskev Stoyanov", Varna
Prof. Marin Drinov Str.55
9002 Varna
 Bulgaria
Tel: +359 (0) 52 - 677 - 052
e-mail: [hidden email]

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

Re: Calculating the area of one channel within an 'island' of a another channel

Angus G
Hi Stoyan!

Firstly thank you! How exactly do I get the macro to run? I tried going to
plugin -> new -> macro then pasted in:

print ("RoiNumber","    ","SliceLabel","    ","RoIName","    ","Count","
","RoIArea","    ","RoIPerimeter","    "," ParticlesCoveredArea","
","AreaFraction") ;
setAutoThreshold("Default dark");
n = roiManager("count");
        for (i=0; i<n; i++)  {
        roiManager("select", i);
        run("Set Measurements...", "area perimeter redirect=None
decimal=4");
    run("Measure");
    r=getResult("Area");
    u=getResult("Perim.");
run("Set Measurements...", "area area_fraction limit display redirect=None
decimal=4");
run("Measure");
s=getResult("Area");
t=getResult("%Area");
run("Analyze Particles...", "size=0-infinity circularity=0.00-1.00
show=Nothing display clear ");
    m=nResults;
     q=getInfo("slice.label");
    print (i,"    ",q,"    ",call("ij.plugin.frame.RoiManager.getName",
i),"    ",m,"    ",r,"    ",u,"    ",s,"    ",t) ;
}

But when I try to run it I get the message:

')' expected in line 2
<",">RolArea"," ","RolPerimeter"," ","ParticlesCoveredArea","

Is this the right way to try and run the macro or am I doing something
grossly wrong? (I have never dealt with macros before!)

Thanks again!
Angus

-----Original Message-----
From: Stoyan Pavlov
Sent: Wednesday, July 03, 2013 1:37 PM
To: [hidden email]
Subject: Re: Calculating the area of one channel within an 'island' of a
another channel

Hi Angus,
*You may try adding the "Islands*" as RoIs to the RoIManager (simply by
running the particle analyzer with the add to manager option on)  and than
using a simple macro you may measure anything within each of the RoIs. I
used to do something similar  with the following macro:

/ This Macro counts particles inside specific Roi and otputs the number to
TAB separated Log window which after saving can be imported to excel.
print ("RoiNumber","    ","SliceLabel","    ","RoIName","    ","Count","
","RoIArea","    ","RoIPerimeter","    "," ParticlesCoveredArea","
","AreaFraction") ;
setAutoThreshold("Default dark");
n = roiManager("count");
        for (i=0; i<n; i++)  {
        roiManager("select", i);
        run("Set Measurements...", "area perimeter redirect=None
decimal=4");
    run("Measure");
    r=getResult("Area");
    u=getResult("Perim.");
run("Set Measurements...", "area area_fraction limit display redirect=None
decimal=4");
run("Measure");
s=getResult("Area");
t=getResult("%Area");
run("Analyze Particles...", "size=0-infinity circularity=0.00-1.00
show=Nothing display clear ");
    m=nResults;
     q=getInfo("slice.label");
    print (i,"    ",q,"    ",call("ij.plugin.frame.RoiManager.getName",
i),"    ",m,"    ",r,"    ",u,"    ",s,"    ",t) ;
}

I hope this helps.

Stoyan


2013/7/3 Angus G <[hidden email]>

> Dear all,
>
> Even if people don’t have a mechanism to achieve this it would be good to
> know if it is possible.
>
> I invert my images, split them into three channels (RBG) and then
> threshold them. I then use watershed to break up the red channel data into
> ‘islands’ of particles. When I use ‘analyse particles’ each ‘island’ gets
> it’s own number and I can obtain the area in pixels of each of these. All’s
> good so far!
>
> What I would like to be able to do is quantify the area of yellow pixels
> within each numbered ‘island’ of red pixels.
>
> If anyone has any ideas or knows if this will not be possible I’d be
> really grateful if you could let me know. If it can be done it will change
> the way I gather data and would greatly improve the results!
>
> Thanks for any help you can provide!
> abg
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>



--
Dr. Stoyan P. Pavlov, MD, PhD
Departament of Anatomy, Histology and Embryology
Medical University "Prof. Dr. Paraskev Stoyanov", Varna
Prof. Marin Drinov Str.55
9002 Varna
Bulgaria
Tel: +359 (0) 52 - 677 - 052
e-mail: [hidden 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: Calculating the area of one channel within an 'island' of a another channel

Stoyan Pavlov
Hi Angus,
The email converted the long lines into several rows so the correct
macro is this one:
// This Macro counts particles inside specific Roi and otputs the
number to TAB separated Log window which after saving can be imported
to excel.
print ("RoiNumber","    ","SliceLabel","    ","RoIName","
","Count","    ","RoIArea","    ","RoIPerimeter","    ","
ParticlesCoveredArea","    ","AreaFraction") ;
setAutoThreshold("Default dark");
 n = roiManager("count");
        for (i=0; i<n; i++)  {
        roiManager("select", i);
        run("Set Measurements...", "area perimeter redirect=None decimal=4");
    run("Measure");
    r=getResult("Area");
    u=getResult("Perim.");
run("Set Measurements...", "area area_fraction limit display
redirect=None decimal=4");
run("Measure");
s=getResult("Area");
t=getResult("%Area");
run("Analyze Particles...", "size=0-infinity circularity=0.00-1.00
show=Nothing display clear ");
    m=nResults;
     q=getInfo("slice.label");
    print (i,"    ",q,"
",call("ij.plugin.frame.RoiManager.getName", i),"    ",m,"    ",r,"
",u,"    ",s,"    ",t) ;
}
If ity still gets converted to multiple lines, know that each line
between () should be on one row and there are TABs between the " "
which seem empty.
Stoyan

2013/7/3 Angus G <[hidden email]>:

> Hi Stoyan!
>
> Firstly thank you! How exactly do I get the macro to run? I tried going to
> plugin -> new -> macro then pasted in:
>
>
> print ("RoiNumber","    ","SliceLabel","    ","RoIName","    ","Count","
> ","RoIArea","    ","RoIPerimeter","    "," ParticlesCoveredArea","
> ","AreaFraction") ;
> setAutoThreshold("Default dark");
> n = roiManager("count");
>        for (i=0; i<n; i++)  {
>        roiManager("select", i);
>        run("Set Measurements...", "area perimeter redirect=None
> decimal=4");
>    run("Measure");
>    r=getResult("Area");
>    u=getResult("Perim.");
> run("Set Measurements...", "area area_fraction limit display redirect=None
> decimal=4");
> run("Measure");
> s=getResult("Area");
> t=getResult("%Area");
> run("Analyze Particles...", "size=0-infinity circularity=0.00-1.00
> show=Nothing display clear ");
>    m=nResults;
>     q=getInfo("slice.label");
>    print (i,"    ",q,"    ",call("ij.plugin.frame.RoiManager.getName",
> i),"    ",m,"    ",r,"    ",u,"    ",s,"    ",t) ;
> }
>
> But when I try to run it I get the message:
>
> ')' expected in line 2
> <",">RolArea"," ","RolPerimeter"," ","ParticlesCoveredArea","
>
> Is this the right way to try and run the macro or am I doing something
> grossly wrong? (I have never dealt with macros before!)
>
> Thanks again!
> Angus
>
> -----Original Message----- From: Stoyan Pavlov
> Sent: Wednesday, July 03, 2013 1:37 PM
> To: [hidden email]
> Subject: Re: Calculating the area of one channel within an 'island' of a
> another channel
>
> Hi Angus,
> *You may try adding the "Islands*" as RoIs to the RoIManager (simply by
>
> running the particle analyzer with the add to manager option on)  and than
> using a simple macro you may measure anything within each of the RoIs. I
> used to do something similar  with the following macro:
>
> / This Macro counts particles inside specific Roi and otputs the number to
> TAB separated Log window which after saving can be imported to excel.
> print ("RoiNumber","    ","SliceLabel","    ","RoIName","    ","Count","
> ","RoIArea","    ","RoIPerimeter","    "," ParticlesCoveredArea","
> ","AreaFraction") ;
> setAutoThreshold("Default dark");
> n = roiManager("count");
>        for (i=0; i<n; i++)  {
>        roiManager("select", i);
>        run("Set Measurements...", "area perimeter redirect=None
> decimal=4");
>    run("Measure");
>    r=getResult("Area");
>    u=getResult("Perim.");
> run("Set Measurements...", "area area_fraction limit display redirect=None
> decimal=4");
> run("Measure");
> s=getResult("Area");
> t=getResult("%Area");
> run("Analyze Particles...", "size=0-infinity circularity=0.00-1.00
> show=Nothing display clear ");
>    m=nResults;
>     q=getInfo("slice.label");
>    print (i,"    ",q,"    ",call("ij.plugin.frame.RoiManager.getName",
> i),"    ",m,"    ",r,"    ",u,"    ",s,"    ",t) ;
> }
>
> I hope this helps.
>
> Stoyan
>
>
> 2013/7/3 Angus G <[hidden email]>
>
>> Dear all,
>>
>> Even if people don’t have a mechanism to achieve this it would be good to
>> know if it is possible.
>>
>> I invert my images, split them into three channels (RBG) and then
>> threshold them. I then use watershed to break up the red channel data into
>> ‘islands’ of particles. When I use ‘analyse particles’ each ‘island’ gets
>> it’s own number and I can obtain the area in pixels of each of these.
>> All’s
>> good so far!
>>
>> What I would like to be able to do is quantify the area of yellow pixels
>> within each numbered ‘island’ of red pixels.
>>
>> If anyone has any ideas or knows if this will not be possible I’d be
>> really grateful if you could let me know. If it can be done it will change
>> the way I gather data and would greatly improve the results!
>>
>> Thanks for any help you can provide!
>> abg
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>
>
>
> --
> Dr. Stoyan P. Pavlov, MD, PhD
> Departament of Anatomy, Histology and Embryology
> Medical University "Prof. Dr. Paraskev Stoyanov", Varna
> Prof. Marin Drinov Str.55
> 9002 Varna
> Bulgaria
> Tel: +359 (0) 52 - 677 - 052
> e-mail: [hidden email]
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html



--
Dr. Stoyan P. Pavlov, MD, PhD
Departament of Anatomy, Histology and Embryology
Medical University "Prof. Dr. Paraskev Stoyanov", Varna
Prof. Marin Drinov Str.55
9002 Varna
 Bulgaria
Tel: +359 (0) 52 - 677 - 052
e-mail: [hidden email]

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

Re: Calculating the area of one channel within an 'island' of a another channel

Stoyan Pavlov
No  it still gets scrambled Here is the original file

2013/7/3 Stoyan Pavlov <[hidden email]>:

> Hi Angus,
> The email converted the long lines into several rows so the correct
> macro is this one:
> // This Macro counts particles inside specific Roi and otputs the
> number to TAB separated Log window which after saving can be imported
> to excel.
> print ("RoiNumber","    ","SliceLabel","    ","RoIName","
> ","Count","    ","RoIArea","    ","RoIPerimeter","    ","
> ParticlesCoveredArea","    ","AreaFraction") ;
> setAutoThreshold("Default dark");
>  n = roiManager("count");
>         for (i=0; i<n; i++)  {
>         roiManager("select", i);
>         run("Set Measurements...", "area perimeter redirect=None decimal=4");
>     run("Measure");
>     r=getResult("Area");
>     u=getResult("Perim.");
> run("Set Measurements...", "area area_fraction limit display
> redirect=None decimal=4");
> run("Measure");
> s=getResult("Area");
> t=getResult("%Area");
> run("Analyze Particles...", "size=0-infinity circularity=0.00-1.00
> show=Nothing display clear ");
>     m=nResults;
>      q=getInfo("slice.label");
>     print (i,"    ",q,"
> ",call("ij.plugin.frame.RoiManager.getName", i),"    ",m,"    ",r,"
> ",u,"    ",s,"    ",t) ;
> }
> If ity still gets converted to multiple lines, know that each line
> between () should be on one row and there are TABs between the " "
> which seem empty.
> Stoyan
>
> 2013/7/3 Angus G <[hidden email]>:
>> Hi Stoyan!
>>
>> Firstly thank you! How exactly do I get the macro to run? I tried going to
>> plugin -> new -> macro then pasted in:
>>
>>
>> print ("RoiNumber","    ","SliceLabel","    ","RoIName","    ","Count","
>> ","RoIArea","    ","RoIPerimeter","    "," ParticlesCoveredArea","
>> ","AreaFraction") ;
>> setAutoThreshold("Default dark");
>> n = roiManager("count");
>>        for (i=0; i<n; i++)  {
>>        roiManager("select", i);
>>        run("Set Measurements...", "area perimeter redirect=None
>> decimal=4");
>>    run("Measure");
>>    r=getResult("Area");
>>    u=getResult("Perim.");
>> run("Set Measurements...", "area area_fraction limit display redirect=None
>> decimal=4");
>> run("Measure");
>> s=getResult("Area");
>> t=getResult("%Area");
>> run("Analyze Particles...", "size=0-infinity circularity=0.00-1.00
>> show=Nothing display clear ");
>>    m=nResults;
>>     q=getInfo("slice.label");
>>    print (i,"    ",q,"    ",call("ij.plugin.frame.RoiManager.getName",
>> i),"    ",m,"    ",r,"    ",u,"    ",s,"    ",t) ;
>> }
>>
>> But when I try to run it I get the message:
>>
>> ')' expected in line 2
>> <",">RolArea"," ","RolPerimeter"," ","ParticlesCoveredArea","
>>
>> Is this the right way to try and run the macro or am I doing something
>> grossly wrong? (I have never dealt with macros before!)
>>
>> Thanks again!
>> Angus
>>
>> -----Original Message----- From: Stoyan Pavlov
>> Sent: Wednesday, July 03, 2013 1:37 PM
>> To: [hidden email]
>> Subject: Re: Calculating the area of one channel within an 'island' of a
>> another channel
>>
>> Hi Angus,
>> *You may try adding the "Islands*" as RoIs to the RoIManager (simply by
>>
>> running the particle analyzer with the add to manager option on)  and than
>> using a simple macro you may measure anything within each of the RoIs. I
>> used to do something similar  with the following macro:
>>
>> / This Macro counts particles inside specific Roi and otputs the number to
>> TAB separated Log window which after saving can be imported to excel.
>> print ("RoiNumber","    ","SliceLabel","    ","RoIName","    ","Count","
>> ","RoIArea","    ","RoIPerimeter","    "," ParticlesCoveredArea","
>> ","AreaFraction") ;
>> setAutoThreshold("Default dark");
>> n = roiManager("count");
>>        for (i=0; i<n; i++)  {
>>        roiManager("select", i);
>>        run("Set Measurements...", "area perimeter redirect=None
>> decimal=4");
>>    run("Measure");
>>    r=getResult("Area");
>>    u=getResult("Perim.");
>> run("Set Measurements...", "area area_fraction limit display redirect=None
>> decimal=4");
>> run("Measure");
>> s=getResult("Area");
>> t=getResult("%Area");
>> run("Analyze Particles...", "size=0-infinity circularity=0.00-1.00
>> show=Nothing display clear ");
>>    m=nResults;
>>     q=getInfo("slice.label");
>>    print (i,"    ",q,"    ",call("ij.plugin.frame.RoiManager.getName",
>> i),"    ",m,"    ",r,"    ",u,"    ",s,"    ",t) ;
>> }
>>
>> I hope this helps.
>>
>> Stoyan
>>
>>
>> 2013/7/3 Angus G <[hidden email]>
>>
>>> Dear all,
>>>
>>> Even if people don’t have a mechanism to achieve this it would be good to
>>> know if it is possible.
>>>
>>> I invert my images, split them into three channels (RBG) and then
>>> threshold them. I then use watershed to break up the red channel data into
>>> ‘islands’ of particles. When I use ‘analyse particles’ each ‘island’ gets
>>> it’s own number and I can obtain the area in pixels of each of these.
>>> All’s
>>> good so far!
>>>
>>> What I would like to be able to do is quantify the area of yellow pixels
>>> within each numbered ‘island’ of red pixels.
>>>
>>> If anyone has any ideas or knows if this will not be possible I’d be
>>> really grateful if you could let me know. If it can be done it will change
>>> the way I gather data and would greatly improve the results!
>>>
>>> Thanks for any help you can provide!
>>> abg
>>>
>>> --
>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>>
>>
>>
>>
>> --
>> Dr. Stoyan P. Pavlov, MD, PhD
>> Departament of Anatomy, Histology and Embryology
>> Medical University "Prof. Dr. Paraskev Stoyanov", Varna
>> Prof. Marin Drinov Str.55
>> 9002 Varna
>> Bulgaria
>> Tel: +359 (0) 52 - 677 - 052
>> e-mail: [hidden email]
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
>
>
> --
> Dr. Stoyan P. Pavlov, MD, PhD
> Departament of Anatomy, Histology and Embryology
> Medical University "Prof. Dr. Paraskev Stoyanov", Varna
> Prof. Marin Drinov Str.55
> 9002 Varna
>  Bulgaria
> Tel: +359 (0) 52 - 677 - 052
> e-mail: [hidden email]


--
Dr. Stoyan P. Pavlov, MD, PhD
Departament of Anatomy, Histology and Embryology
Medical University "Prof. Dr. Paraskev Stoyanov", Varna
Prof. Marin Drinov Str.55
9002 Varna
 Bulgaria
Tel: +359 (0) 52 - 677 - 052
e-mail: [hidden email]

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

CountPaticlesinROIS_.txt (1K) Download Attachment