How to count the number of intersecting ROIs for a given ROI

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

How to count the number of intersecting ROIs for a given ROI

LyleBabcock
I've written a plugin that analyzes skeletal muscle fiber size, type, and
central nuclei. I want to give it the ability to count regular nuclei, and
the code right now prints a list of all the muscle fibers with intersecting
ROIs (or nuclei). Below is an example of my code for how I analyze central
nuclei. It works perfectly for central nuclei, as there is ever only going
to be one central nuclei in a fiber and the end results is a results page
that lists fiber number, fiber type, area, and either "1" if there is a
central nuclei, and "0" if there isn't one. The problem with regular nuclei
is that most of the fibers have more than one nuclei, so that fiber number
is simply listed multiple times, and I end up having a list that I can't
simply put into an array and make it a column in my results. For example, if
fiber #35 has 3 nuclei, the program prints out "35" three times. How to I
get the program to denote that there are 3 intersections with fiber #35, and
not a list with "35" written 3 times?

for (i=0;i<counts; i++){
  for (j=0;j&lt;roiManager(&quot;count&quot;);j++){
    roiManager('select',newArray(i,j));
    roiManager(&quot;AND&quot;);
    if ((i!=j)&amp;&amp;(selectionType>-1)) {
    print(i);
                logString = getInfo("log");
    }
  }
}
if (isOpen("Log")) {
    run("Clear Results");
        roiManager("reset");
        roiManager("open", Results+"ROISet.zip");
        selectWindow("Fiber Borders");
        run("From ROI Manager");
        roiManager("multi-measure append");
        updateResults();
        setResult("Central Nuclei", logString, 1);



--
Sent from: http://imagej.1557.x6.nabble.com/

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

Re: How to count the number of intersecting ROIs for a given ROI

Herbie
Lyle,

if you cross-post to the Forum (as in this case) and vice versa please
make sure to mention that you did just that, otherwise one cannot follow
which contributions, suggestions and solutions have been made.

Thank you!

Regards

Herbie

:::::::::::::::::::::::::::::::::::::::::
Am 15.10.19 um 17:00 schrieb LyleBabcock:

> I've written a plugin that analyzes skeletal muscle fiber size, type, and
> central nuclei. I want to give it the ability to count regular nuclei, and
> the code right now prints a list of all the muscle fibers with intersecting
> ROIs (or nuclei). Below is an example of my code for how I analyze central
> nuclei. It works perfectly for central nuclei, as there is ever only going
> to be one central nuclei in a fiber and the end results is a results page
> that lists fiber number, fiber type, area, and either "1" if there is a
> central nuclei, and "0" if there isn't one. The problem with regular nuclei
> is that most of the fibers have more than one nuclei, so that fiber number
> is simply listed multiple times, and I end up having a list that I can't
> simply put into an array and make it a column in my results. For example, if
> fiber #35 has 3 nuclei, the program prints out "35" three times. How to I
> get the program to denote that there are 3 intersections with fiber #35, and
> not a list with "35" written 3 times?
>
> for (i=0;i<counts; i++){
>    for (j=0;j&lt;roiManager(&quot;count&quot;);j++){
>      roiManager('select',newArray(i,j));
>      roiManager(&quot;AND&quot;);
>      if ((i!=j)&amp;&amp;(selectionType>-1)) {
>       print(i);
> logString = getInfo("log");
>      }
>    }
> }
> if (isOpen("Log")) {
>     run("Clear Results");
> roiManager("reset");
> roiManager("open", Results+"ROISet.zip");
> selectWindow("Fiber Borders");
> run("From ROI Manager");
> roiManager("multi-measure append");
> updateResults();
> setResult("Central Nuclei", logString, 1);
>
>
>
> --
> Sent from: http://imagej.1557.x6.nabble.com/
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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