distribution analysis - nearest neighbourhood ?

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

distribution analysis - nearest neighbourhood ?

Jędrzejas, Magdalena
Hello,
I have different images representing some inflamatory cells in the rat brain - in some images the cells are more clustered and in another ones more disseminated. I would like to do some analysis of distribution of these cells to compare different images. Im looking for some plugin which could measure for example mean distance between objects or something like that.
could anyone help me?
Magda

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

Re: distribution analysis - nearest neighbourhood ?

Peter Haub
Hi Magda,

is it possible to clearly separate the objects?
Or do the objects build inseparable clusters?
An image would be helpful.

Regards,
Peter

On 16.08.2013 08:43, Jędrzejas, Magdalena wrote:
> Hello,
> I have different images representing some inflamatory cells in the rat brain - in some images the cells are more clustered and in another ones more disseminated. I would like to do some analysis of distribution of these cells to compare different images. Im looking for some plugin which could measure for example mean distance between objects or something like that.
> could anyone help me?
> Magda
>
> --
> 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: distribution analysis - nearest neighbourhood ?

LIM Soon Yew John (IMB)
In reply to this post by Jędrzejas, Magdalena
Hi Magda,

I had wrote a macro that calculate the distance between each ROI in the ROI manager. You could modify this to find for example the mean distance between objects. Please see the macros below:

//Load an image and segment out the nuclei to ROI Manager
run("Fluorescent Cells (400K)");
run("Duplicate...", "title=FluorescentCells-2.tif duplicate channels=3");
setAutoThreshold("Default dark");
roiManager("Show All with labels");
roiManager("Show All");
run("Analyze Particles...", "size=500-Infinity circularity=0.50-1.00 show=Nothing add");

//Calculate the distance between each ROI and output to Results
function length (x1, y1, x2, y2) {
 sum_difference_squared = pow((x2 - x1),2) + pow((y2 - y1),2);
 output = pow(sum_difference_squared, 0.5);
 return output; //name of return variable and function cannot be same
}
run("Clear Results");
run("Set Measurements...", "  centroid display redirect=None decimal=3");
roiManager("Deselect"); //Made ImageJ measure all ROI
roiManager("Measure");
r=nResults(); //Number of result
//Create new array variables
Label=newArray(r);
X=newArray(r);
Y=newArray(r);
//Extract from Results window and inset results into arrays
for(i=0;i<r;i++) { //index starts at 0
Label[i]=getResultLabel(i);
X[i]=getResult("X",i);
Y[i]=getResult("Y",i);
}
//Measure the centroid distance between two ROI
d=newArray(r);
for(ROI=0;ROI<r;ROI++) {
for(i=0;i<r;i++) {
d[i]=length(X[ROI],Y[ROI],X[i],Y[i]);
setResult(Label[ROI], i, d[i]);
}
}

Best Regards,
John
________________________________________
From: ImageJ Interest Group [[hidden email]] On Behalf Of Jędrzejas, Magdalena [[hidden email]]
Sent: Friday, August 16, 2013 2:43 PM
To: [hidden email]
Subject: distribution analysis - nearest neighbourhood ?

Hello,
I have different images representing some inflamatory cells in the rat brain - in some images the cells are more clustered and in another ones more disseminated. I would like to do some analysis of distribution of these cells to compare different images. Im looking for some plugin which could measure for example mean distance between objects or something like that.
could anyone help me?
Magda

--
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: distribution analysis - nearest neighbourhood ?

Peter Haub
In reply to this post by Jędrzejas, Magdalena
Hi Magda,

the image you send shows two different areas marked with green and red
outline on a empty/black background. In these areas are some colored
pixels, in the green area with different colors.
How should this image be interpreted? Can you help a bit to help you?

Is this an image of a brain section, manually separated into different
areas?
The single color pixel symbolizing the cells?
Whats about connected pixel? Are they connected cells?

What would be a meaningful measurement? What is the effect you want to
quantify?
What mean distance you are interested in? The mean of the mean distance
between the cells/pixels? Or e.g. the mean of the max distance? ..
Should this be a global measurement or are you looking for the spatial
distribution of those values, measured in limited local boundaries?
Does the measurement have to take the pixel color into account?

Or is this image corrupted?

Peter

On 16.08.2013 08:43, Jędrzejas, Magdalena wrote:
> Hello,
> I have different images representing some inflamatory cells in the rat brain - in some images the cells are more clustered and in another ones more disseminated. I would like to do some analysis of distribution of these cells to compare different images. Im looking for some plugin which could measure for example mean distance between objects or something like that.
> could anyone help me?
> Magda
>
> --
> 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
|

AW: distribution analysis - nearest neighbourhood ?

Jędrzejas, Magdalena
Hello Peter,
It is not a corrupted image. It shows brain section manually divided into two hemispheres. The green and the red lines show the borders of each hemisphere.  The single color pixel symbolize a cell. Probably connected pixels are connected cells. I would like to compare somehow the distribution of cells (in one hemisphere (-red) there are certainly more cell clusters ) between these two hemispheres. So definitely I have to take into account the color of pixel - I want to compare the distribution of red and green pixels. Maybe the mean distance from the border or the mean of the mean distance between the cells/pixels would be a good solution? My supervisor told me also to read sth about nearest neighbors algorithm...
Magda

 -----Ursprüngliche Nachricht-----
Von: ImageJ Interest Group [mailto:[hidden email]] Im Auftrag von Peter Haub
Gesendet: Freitag, 16. August 2013 11:11
An: [hidden email]
Betreff: Re: distribution analysis - nearest neighbourhood ?

Hi Magda,

the image you send shows two different areas marked with green and red outline on a empty/black background. In these areas are some colored pixels, in the green area with different colors.
How should this image be interpreted? Can you help a bit to help you?

Is this an image of a brain section, manually separated into different areas?
The single color pixel symbolizing the cells?
Whats about connected pixel? Are they connected cells?

What would be a meaningful measurement? What is the effect you want to quantify?
What mean distance you are interested in? The mean of the mean distance between the cells/pixels? Or e.g. the mean of the max distance? ..
Should this be a global measurement or are you looking for the spatial distribution of those values, measured in limited local boundaries?
Does the measurement have to take the pixel color into account?

Or is this image corrupted?

Peter

On 16.08.2013 08:43, Jędrzejas, Magdalena wrote:
> Hello,
> I have different images representing some inflamatory cells in the rat brain - in some images the cells are more clustered and in another ones more disseminated. I would like to do some analysis of distribution of these cells to compare different images. Im looking for some plugin which could measure for example mean distance between objects or something like that.
> could anyone help me?
> Magda
>
> --
> 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
Reply | Threaded
Open this post in threaded view
|

Re: AW: distribution analysis - nearest neighbourhood ?

Thomas Boudier
Hi,

Maybe have a look to spatial statistics :

http://imagejdocu.tudor.lu/doku.php?id=plugin:analysis:spatial_statistics_2d_3d:start

best,

Thomas


Le 16/08/2013 13:29, Jędrzejas, Magdalena a écrit :

> Hello Peter,
> It is not a corrupted image. It shows brain section manually divided into two hemispheres. The green and the red lines show the borders of each hemisphere.  The single color pixel symbolize a cell. Probably connected pixels are connected cells. I would like to compare somehow the distribution of cells (in one hemisphere (-red) there are certainly more cell clusters ) between these two hemispheres. So definitely I have to take into account the color of pixel - I want to compare the distribution of red and green pixels. Maybe the mean distance from the border or the mean of the mean distance between the cells/pixels would be a good solution? My supervisor told me also to read sth about nearest neighbors algorithm...
> Magda
>
>   -----Ursprüngliche Nachricht-----
> Von: ImageJ Interest Group [mailto:[hidden email]] Im Auftrag von Peter Haub
> Gesendet: Freitag, 16. August 2013 11:11
> An: [hidden email]
> Betreff: Re: distribution analysis - nearest neighbourhood ?
>
> Hi Magda,
>
> the image you send shows two different areas marked with green and red outline on a empty/black background. In these areas are some colored pixels, in the green area with different colors.
> How should this image be interpreted? Can you help a bit to help you?
>
> Is this an image of a brain section, manually separated into different areas?
> The single color pixel symbolizing the cells?
> Whats about connected pixel? Are they connected cells?
>
> What would be a meaningful measurement? What is the effect you want to quantify?
> What mean distance you are interested in? The mean of the mean distance between the cells/pixels? Or e.g. the mean of the max distance? ..
> Should this be a global measurement or are you looking for the spatial distribution of those values, measured in limited local boundaries?
> Does the measurement have to take the pixel color into account?
>
> Or is this image corrupted?
>
> Peter
>
> On 16.08.2013 08:43, Jędrzejas, Magdalena wrote:
>> Hello,
>> I have different images representing some inflamatory cells in the rat brain - in some images the cells are more clustered and in another ones more disseminated. I would like to do some analysis of distribution of these cells to compare different images. Im looking for some plugin which could measure for example mean distance between objects or something like that.
>> could anyone help me?
>> Magda
>>
>> --
>> 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
>

--
   /**********************************************************/
      Thomas Boudier, MCU Université Pierre et Marie Curie,
      Modélisation Cellulaire et Imagerie Biologique (EE1),
      IFR 83, Bat B 7ème étage, porte 723, Campus Jussieu.
      Tel : 01 44 27 46 92   Fax : 01 44 27 22 91
/*******************************************************/

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

Re: AW: distribution analysis - nearest neighbourhood ?

Peter Haub
In reply to this post by Jędrzejas, Magdalena
Hi Magda,

ok, then my interpretation wasn't that wrong. (Still I have the question
if there is a difference between the different colored pixels in the
green region. There are not only green pixel but yellow etc.  ??)

The Nearest Neighbor analysis is for sure very much leading to an
interesting measurement.
Check
https://icme.hpc.msstate.edu/mediawiki/index.php/Nearest_Neighbor_Distances_Calculation_with_ImageJ
and
http://imagej.1557.x6.nabble.com/Nearest-Neighbor-Analysis-td3693312.html
Maybe this could help.

Another idea would be to calculate the cell density in a sliding window
(with configurable size and form).
I have done this once in an easy way by drawing a filled area object
(square or circle) of a certain size for each cell/pixel into a new image.
If this area object are drawn with the intensity of 1 the result image
contains the number of cells in the area (defined by the square or
circle) directly at the xy coordinates of the cells/pixels.
A macro should look like:
     - Loop all pixel
           - for all cell pixels
                 draw filled area object with Int=1 into new "density"
image (16bit if the area object is large)

     - Loop all pixel
         - for all NON cell pixels
             set pixel to 0 in the "density" image

In this way the "density" image gives you the cell density with regards
to your sample area in a very simple and fast way.

Best regards,
Peter

On 16.08.2013 13:29, Jędrzejas, Magdalena wrote:

> Hello Peter,
> It is not a corrupted image. It shows brain section manually divided into two hemispheres. The green and the red lines show the borders of each hemisphere.  The single color pixel symbolize a cell. Probably connected pixels are connected cells. I would like to compare somehow the distribution of cells (in one hemisphere (-red) there are certainly more cell clusters ) between these two hemispheres. So definitely I have to take into account the color of pixel - I want to compare the distribution of red and green pixels. Maybe the mean distance from the border or the mean of the mean distance between the cells/pixels would be a good solution? My supervisor told me also to read sth about nearest neighbors algorithm...
> Magda
>
>   -----Ursprüngliche Nachricht-----
> Von: ImageJ Interest Group [mailto:[hidden email]] Im Auftrag von Peter Haub
> Gesendet: Freitag, 16. August 2013 11:11
> An: [hidden email]
> Betreff: Re: distribution analysis - nearest neighbourhood ?
>
> Hi Magda,
>
> the image you send shows two different areas marked with green and red outline on a empty/black background. In these areas are some colored pixels, in the green area with different colors.
> How should this image be interpreted? Can you help a bit to help you?
>
> Is this an image of a brain section, manually separated into different areas?
> The single color pixel symbolizing the cells?
> Whats about connected pixel? Are they connected cells?
>
> What would be a meaningful measurement? What is the effect you want to quantify?
> What mean distance you are interested in? The mean of the mean distance between the cells/pixels? Or e.g. the mean of the max distance? ..
> Should this be a global measurement or are you looking for the spatial distribution of those values, measured in limited local boundaries?
> Does the measurement have to take the pixel color into account?
>
> Or is this image corrupted?
>
> Peter
>
> On 16.08.2013 08:43, Jędrzejas, Magdalena wrote:
>> Hello,
>> I have different images representing some inflamatory cells in the rat brain - in some images the cells are more clustered and in another ones more disseminated. I would like to do some analysis of distribution of these cells to compare different images. Im looking for some plugin which could measure for example mean distance between objects or something like that.
>> could anyone help me?
>> Magda
>>
>> --
>> 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

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

Re: distribution analysis - nearest neighbourhood ?

Kenneth Sloan
In reply to this post by Jędrzejas, Magdalena
You want to search on : "spatial statistics", "Voronoi Diagram", and perhaps "Delaunay Triangulation".

When I do similar things, I use ImageJ to collect a set of (x,y) points (perhaps the centroids of ROIs) and then use non-ImageJ code (usually home brew Java code, lately) to analyze the point set.  

Very loosely speaking, "spatial statistics" tends to involve analysis of distributions of distances involving all pairs of points, while Voronoi analysis first creates a graph from which you can identify the "nearest neighbors" of each point (among other things), which you then use to compute such things as  "mean distance to a neighbor", or the area and shape of the part of the plane represented by each point.  I have used "spatial statistics" methods in the past, but now much prefer Voronoi analysis (just advertising my particular biases)

First, do a literature search on those terms.  Then, use ImageJ to output point sets.  At that point, poke me privately and I might be able to send you some Java code that would give you a good starting point (not ImageJ based, but if you want to do the integration, feel free!)

There may already be an ImageJ implementation of Voronoi analysis, but if so I am ignorant if it.  It would not be difficult, but I have never had the time to do it.  I will probably assign it to someone in my ImageJ-based IP course next Spring - but you probably can't wait that long.  

This may be heresy on this list, but I have always found it easier to use ImageJ to do the IP, and then do the geometric analysis elsewhere.  But, that's just personal preference, and the fact that my geometric analysis work predates NIH Image...

-Kenneth Sloan
(von meinem iPhone4S gesendet)

On Aug 16, 2013, at 1:43, Jędrzejas wrote:

> Hello,
> I have different images representing some inflamatory cells in the rat brain - in some images the cells are more clustered and in another ones more disseminated. I would like to do some analysis of distribution of these cells to compare different images. Im looking for some plugin which could measure for example mean distance between objects or something like that.
> could anyone help me?
> Magda
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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