Pair correlation function on ImageJ

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

Pair correlation function on ImageJ

Xiao Zhong
Hi everyone,

I am Ph.D. candidate and am working on a project concerning colloidal
particle packing. I am new to ImageJ and I was wondering if anyone knows
how to use it to calculate pair correlation function of a certain 2D area
with packed particles.

Thanks!

Best,
Xiao

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

Re: Pair correlation function on ImageJ

Herbie
Xiao,

it's always a good idea to first consult the user guide...

You may have a look at page

<http://rsb.info.nih.gov/ij/docs/guide/146-29.html#toc-Subsection-29.10>

Subsection " 29.10.7 FD Math… "

If you use Image1 = Image2, i.e. the same image, then you get the
auto-correlation function and I guess this is what you want.

HTH

Herbie

::::::::::::::::::::::::::::::::::::::::
Am 15.07.15 um 15:29 schrieb Xiao Zhong:

> Hi everyone,
>
> I am Ph.D. candidate and am working on a project concerning colloidal
> particle packing. I am new to ImageJ and I was wondering if anyone knows
> how to use it to calculate pair correlation function of a certain 2D area
> with packed particles.
>
> Thanks!
>
> Best,
> Xiao
>
> --
> 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: Pair correlation function on ImageJ

Richard Mort-2
I think in this context Xiao is looking for the spatial statistic. I'm
not aware of an IJ plugin to do this at the moment but it is on my to do
list as its a very useful method. The quickest approach would be to
segment your images and then use analyze particles to get the XY
positions of each object. Save as .csv and then import this data into R
and use the spatstat package:

http://www.inside-r.org/packages/cran/spatstat/docs/pcf

Best
R

On 15/07/15 16:16, Herbie wrote:

> Xiao,
>
> it's always a good idea to first consult the user guide...
>
> You may have a look at page
>
> <http://rsb.info.nih.gov/ij/docs/guide/146-29.html#toc-Subsection-29.10>
>
> Subsection " 29.10.7 FD Math… "
>
> If you use Image1 = Image2, i.e. the same image, then you get the
> auto-correlation function and I guess this is what you want.
>
> HTH
>
> Herbie
>
> ::::::::::::::::::::::::::::::::::::::::
> Am 15.07.15 um 15:29 schrieb Xiao Zhong:
>> Hi everyone,
>>
>> I am Ph.D. candidate and am working on a project concerning colloidal
>> particle packing. I am new to ImageJ and I was wondering if anyone knows
>> how to use it to calculate pair correlation function of a certain 2D
>> area
>> with packed particles.
>>
>> Thanks!
>>
>> Best,
>> Xiao
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
Dr Richard Mort
Research Fellow
MRC Human Genetics Unit
Institute of Genetics and Molecular Medicine
University of Edinburgh
Western General Hospital
Crewe Road
Edinburgh
EH4 2XU

Tel: 0131 651 8648


The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

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

Re: Pair correlation function on ImageJ

Herbie
Dear Richard,

the poster Xiao is not very clear, or at least I don't know what "packed
particles" are.

If "pair correlation function of a certain 2D area" means pixel-pair
correlation in that area, I'm pretty sure that this spatial statistic is
identical to the auto-correlation function of the image in this area.

Best

Herbie

::::::::::::::::::::::::::::::::::::::::::
Am 15.07.15 um 17:38 schrieb Richard Mort:

> I think in this context Xiao is looking for the spatial statistic. I'm
> not aware of an IJ plugin to do this at the moment but it is on my to do
> list as its a very useful method. The quickest approach would be to
> segment your images and then use analyze particles to get the XY
> positions of each object. Save as .csv and then import this data into R
> and use the spatstat package:
>
> http://www.inside-r.org/packages/cran/spatstat/docs/pcf
>
> Best
> R
>
> On 15/07/15 16:16, Herbie wrote:
>> Xiao,
>>
>> it's always a good idea to first consult the user guide...
>>
>> You may have a look at page
>>
>> <http://rsb.info.nih.gov/ij/docs/guide/146-29.html#toc-Subsection-29.10>
>>
>> Subsection " 29.10.7 FD Math… "
>>
>> If you use Image1 = Image2, i.e. the same image, then you get the
>> auto-correlation function and I guess this is what you want.
>>
>> HTH
>>
>> Herbie
>>
>> ::::::::::::::::::::::::::::::::::::::::
>> Am 15.07.15 um 15:29 schrieb Xiao Zhong:
>>> Hi everyone,
>>>
>>> I am Ph.D. candidate and am working on a project concerning colloidal
>>> particle packing. I am new to ImageJ and I was wondering if anyone knows
>>> how to use it to calculate pair correlation function of a certain 2D
>>> area
>>> with packed particles.
>>>
>>> Thanks!
>>>
>>> Best,
>>> Xiao
>>>
>>> --
>>> 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: Pair correlation function on ImageJ

Xiao Zhong
Hi everyone,

Thanks for the reply. I have attached a piece of my data here. I just
wanted to calculate the pair correlation function of these particles
(g(r)). Since I know different packings would give different g(r).  This
attached image has spheres roughly form a 2D close packing, which should
give a g(r) that is different than other types of packings.

I'd appreciate any inputs on this issue.

Thanks,
Xiao

Xiao Zhong
Ph.D. Candidate in Chemistry
Department of Chemistry and Molecular Design Institute
New York University

On Wed, Jul 15, 2015 at 11:58 AM, Herbie <[hidden email]> wrote:

> Dear Richard,
>
> the poster Xiao is not very clear, or at least I don't know what "packed
> particles" are.
>
> If "pair correlation function of a certain 2D area" means pixel-pair
> correlation in that area, I'm pretty sure that this spatial statistic is
> identical to the auto-correlation function of the image in this area.
>
> Best
>
> Herbie
>
> ::::::::::::::::::::::::::::::::::::::::::
> Am 15.07.15 um 17:38 schrieb Richard Mort:
>
>  I think in this context Xiao is looking for the spatial statistic. I'm
>> not aware of an IJ plugin to do this at the moment but it is on my to do
>> list as its a very useful method. The quickest approach would be to
>> segment your images and then use analyze particles to get the XY
>> positions of each object. Save as .csv and then import this data into R
>> and use the spatstat package:
>>
>> http://www.inside-r.org/packages/cran/spatstat/docs/pcf
>>
>> Best
>> R
>>
>> On 15/07/15 16:16, Herbie wrote:
>>
>>> Xiao,
>>>
>>> it's always a good idea to first consult the user guide...
>>>
>>> You may have a look at page
>>>
>>> <http://rsb.info.nih.gov/ij/docs/guide/146-29.html#toc-Subsection-29.10>
>>>
>>> Subsection " 29.10.7 FD Math… "
>>>
>>> If you use Image1 = Image2, i.e. the same image, then you get the
>>> auto-correlation function and I guess this is what you want.
>>>
>>> HTH
>>>
>>> Herbie
>>>
>>> ::::::::::::::::::::::::::::::::::::::::
>>> Am 15.07.15 um 15:29 schrieb Xiao Zhong:
>>>
>>>> Hi everyone,
>>>>
>>>> I am Ph.D. candidate and am working on a project concerning colloidal
>>>> particle packing. I am new to ImageJ and I was wondering if anyone knows
>>>> how to use it to calculate pair correlation function of a certain 2D
>>>> area
>>>> with packed particles.
>>>>
>>>> Thanks!
>>>>
>>>> Best,
>>>> Xiao
>>>>
>>>> --
>>>> 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

Colloidal Packing.png (252K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Pair correlation function on ImageJ

Michael Schmid
In reply to this post by Xiao Zhong
Hi Xiao,

in addition to the ImageJ built-in Fourier Math mentioned by Herbie, there
are also two macros that you might consider - they have the advantage that
they automatically correct for effects of finite image size:

http://imagejdocu.tudor.lu/doku.php?id=macro:radially_averaged_autocorrelation
  for the autocorrelation of a binary image and
http://imagejdocu.tudor.lu/doku.php?id=macro:radial_distribution_function
 for the radial distribution function of particle centers.

If you delete everything starting with creating the radial profile, you
can use these also to get a 2D autocorrelation without having to bother
about finite image size.

Michael
___________________________________________________________________


On Wed, July 15, 2015 15:29, Xiao Zhong wrote:

> Hi everyone,
>
> I am Ph.D. candidate and am working on a project concerning colloidal
> particle packing. I am new to ImageJ and I was wondering if anyone knows
> how to use it to calculate pair correlation function of a certain 2D area
> with packed particles.
>
> Thanks!
>
> Best,
> Xiao
>
> --
> 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: Pair correlation function on ImageJ

Richard Mort-2
In reply to this post by Xiao Zhong
Hi Xaio and Herbie,

Apologies that this is straying in its relevance from the ImageJ list.
Please email me off list if I can help further.

But for completeness here is a method to get the g(r) for the pairwise
correlation function (images attached). You might need to consider
cropping the image depending on what you are interested in.

Herbie I'd be interested to know if something similar can be generated
using standard ImageJ methods.

Using R and ImageJ in a workflow like this can be very useful especially
when complex summary statistics are needed.

Best wishes
Richard

In ImageJ:

///////////////////////////////////
//something like this gives you the positions
run("8-bit");
setThreshold(148, 255);
run("Analyze Particles...", "size=2-Infinity display exclude clear add
in_situ");
selectWindow("Results");
saveAs("Results", "/your_dir/PPP.csv");

//end

Then in R with the package spatstat installed:

###################
library(spatstat)
setwd("/your_dir/")
data1 = read.csv("PPP.csv")
attach(data1)
x <- data1[[03]]
y <- data1[[04]]
plot(x,y)#to check the data is the data looks OK
data2 <- ppp(x, y, xrange=c(0,464), yrange=c(0,377))#note dimensions of
your image
pcf1 = pcf(data2)
plot(pcf1)

#end



On 15/07/15 20:05, Xiao Zhong wrote:

> Hi everyone,
>
> Thanks for the reply. I have attached a piece of my data here. I just
> wanted to calculate the pair correlation function of these particles
> (g(r)). Since I know different packings would give different g(r).  This
> attached image has spheres roughly form a 2D close packing, which should
> give a g(r) that is different than other types of packings.
>
> I'd appreciate any inputs on this issue.
>
> Thanks,
> Xiao
>
> Xiao Zhong
> Ph.D. Candidate in Chemistry
> Department of Chemistry and Molecular Design Institute
> New York University
>
> On Wed, Jul 15, 2015 at 11:58 AM, Herbie <[hidden email]> wrote:
>
>> Dear Richard,
>>
>> the poster Xiao is not very clear, or at least I don't know what "packed
>> particles" are.
>>
>> If "pair correlation function of a certain 2D area" means pixel-pair
>> correlation in that area, I'm pretty sure that this spatial statistic is
>> identical to the auto-correlation function of the image in this area.
>>
>> Best
>>
>> Herbie
>>
>> ::::::::::::::::::::::::::::::::::::::::::
>> Am 15.07.15 um 17:38 schrieb Richard Mort:
>>
>>   I think in this context Xiao is looking for the spatial statistic. I'm
>>> not aware of an IJ plugin to do this at the moment but it is on my to do
>>> list as its a very useful method. The quickest approach would be to
>>> segment your images and then use analyze particles to get the XY
>>> positions of each object. Save as .csv and then import this data into R
>>> and use the spatstat package:
>>>
>>> http://www.inside-r.org/packages/cran/spatstat/docs/pcf
>>>
>>> Best
>>> R
>>>
>>> On 15/07/15 16:16, Herbie wrote:
>>>
>>>> Xiao,
>>>>
>>>> it's always a good idea to first consult the user guide...
>>>>
>>>> You may have a look at page
>>>>
>>>> <http://rsb.info.nih.gov/ij/docs/guide/146-29.html#toc-Subsection-29.10>
>>>>
>>>> Subsection " 29.10.7 FD Math… "
>>>>
>>>> If you use Image1 = Image2, i.e. the same image, then you get the
>>>> auto-correlation function and I guess this is what you want.
>>>>
>>>> HTH
>>>>
>>>> Herbie
>>>>
>>>> ::::::::::::::::::::::::::::::::::::::::
>>>> Am 15.07.15 um 15:29 schrieb Xiao Zhong:
>>>>
>>>>> Hi everyone,
>>>>>
>>>>> I am Ph.D. candidate and am working on a project concerning colloidal
>>>>> particle packing. I am new to ImageJ and I was wondering if anyone knows
>>>>> how to use it to calculate pair correlation function of a certain 2D
>>>>> area
>>>>> with packed particles.
>>>>>
>>>>> Thanks!
>>>>>
>>>>> Best,
>>>>> Xiao
>>>>>
>>>>> --
>>>>> 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
--
Dr Richard Mort
Research Fellow
MRC Human Genetics Unit
Institute of Genetics and Molecular Medicine
University of Edinburgh
Western General Hospital
Crewe Road
Edinburgh
EH4 2XU

Tel: 0131 651 8648


The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.


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

pcf.png (71K) Download Attachment
data.png (388K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Pair correlation function on ImageJ

Xiao Zhong
Hi Richard,

Thank you very much!

This is very helpful!

Thanks,
Xiao

Xiao Zhong
Ph.D. Candidate in Chemistry
Department of Chemistry and Molecular Design Institute
New York University

On Thu, Jul 16, 2015 at 6:14 AM, Richard Mort <[hidden email]>
wrote:

> Hi Xaio and Herbie,
>
> Apologies that this is straying in its relevance from the ImageJ list.
> Please email me off list if I can help further.
>
> But for completeness here is a method to get the g(r) for the pairwise
> correlation function (images attached). You might need to consider cropping
> the image depending on what you are interested in.
>
> Herbie I'd be interested to know if something similar can be generated
> using standard ImageJ methods.
>
> Using R and ImageJ in a workflow like this can be very useful especially
> when complex summary statistics are needed.
>
> Best wishes
> Richard
>
> In ImageJ:
>
> ///////////////////////////////////
> //something like this gives you the positions
> run("8-bit");
> setThreshold(148, 255);
> run("Analyze Particles...", "size=2-Infinity display exclude clear add
> in_situ");
> selectWindow("Results");
> saveAs("Results", "/your_dir/PPP.csv");
>
> //end
>
> Then in R with the package spatstat installed:
>
> ###################
> library(spatstat)
> setwd("/your_dir/")
> data1 = read.csv("PPP.csv")
> attach(data1)
> x <- data1[[03]]
> y <- data1[[04]]
> plot(x,y)#to check the data is the data looks OK
> data2 <- ppp(x, y, xrange=c(0,464), yrange=c(0,377))#note dimensions of
> your image
> pcf1 = pcf(data2)
> plot(pcf1)
>
> #end
>
>
>
>
> On 15/07/15 20:05, Xiao Zhong wrote:
>
>> Hi everyone,
>>
>> Thanks for the reply. I have attached a piece of my data here. I just
>> wanted to calculate the pair correlation function of these particles
>> (g(r)). Since I know different packings would give different g(r).  This
>> attached image has spheres roughly form a 2D close packing, which should
>> give a g(r) that is different than other types of packings.
>>
>> I'd appreciate any inputs on this issue.
>>
>> Thanks,
>> Xiao
>>
>> Xiao Zhong
>> Ph.D. Candidate in Chemistry
>> Department of Chemistry and Molecular Design Institute
>> New York University
>>
>> On Wed, Jul 15, 2015 at 11:58 AM, Herbie <[hidden email]> wrote:
>>
>>  Dear Richard,
>>>
>>> the poster Xiao is not very clear, or at least I don't know what "packed
>>> particles" are.
>>>
>>> If "pair correlation function of a certain 2D area" means pixel-pair
>>> correlation in that area, I'm pretty sure that this spatial statistic is
>>> identical to the auto-correlation function of the image in this area.
>>>
>>> Best
>>>
>>> Herbie
>>>
>>> ::::::::::::::::::::::::::::::::::::::::::
>>> Am 15.07.15 um 17:38 schrieb Richard Mort:
>>>
>>>   I think in this context Xiao is looking for the spatial statistic. I'm
>>>
>>>> not aware of an IJ plugin to do this at the moment but it is on my to do
>>>> list as its a very useful method. The quickest approach would be to
>>>> segment your images and then use analyze particles to get the XY
>>>> positions of each object. Save as .csv and then import this data into R
>>>> and use the spatstat package:
>>>>
>>>> http://www.inside-r.org/packages/cran/spatstat/docs/pcf
>>>>
>>>> Best
>>>> R
>>>>
>>>> On 15/07/15 16:16, Herbie wrote:
>>>>
>>>>  Xiao,
>>>>>
>>>>> it's always a good idea to first consult the user guide...
>>>>>
>>>>> You may have a look at page
>>>>>
>>>>> <
>>>>> http://rsb.info.nih.gov/ij/docs/guide/146-29.html#toc-Subsection-29.10
>>>>> >
>>>>>
>>>>> Subsection " 29.10.7 FD Math… "
>>>>>
>>>>> If you use Image1 = Image2, i.e. the same image, then you get the
>>>>> auto-correlation function and I guess this is what you want.
>>>>>
>>>>> HTH
>>>>>
>>>>> Herbie
>>>>>
>>>>> ::::::::::::::::::::::::::::::::::::::::
>>>>> Am 15.07.15 um 15:29 schrieb Xiao Zhong:
>>>>>
>>>>>  Hi everyone,
>>>>>>
>>>>>> I am Ph.D. candidate and am working on a project concerning colloidal
>>>>>> particle packing. I am new to ImageJ and I was wondering if anyone
>>>>>> knows
>>>>>> how to use it to calculate pair correlation function of a certain 2D
>>>>>> area
>>>>>> with packed particles.
>>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>> Best,
>>>>>> Xiao
>>>>>>
>>>>>> --
>>>>>> 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
>>
>
> --
> Dr Richard Mort
> Research Fellow
> MRC Human Genetics Unit
> Institute of Genetics and Molecular Medicine
> University of Edinburgh
> Western General Hospital
> Crewe Road
> Edinburgh
> EH4 2XU
>
> Tel: 0131 651 8648
>
>
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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