Solved – statistical method for spatial correlation between images

correlationimage processingspatial

I am working on analyzing a data set and I was wondering what would be the most statistically valid method of demonstrating that there is a strong spatial correlation between images.

I have a data set with about 50 pairs of images of cancerous tissue samples. The first image in each pair shows the locations of gold nanoparticles, and the second image shows the locations of the blood vessels in the same tissue sample. By looking at the images it is easy to see that the locations of the nanoparticles match up with the blood vessels, but I would like to prove this statistically in the paper. This is an important point because it demonstrates that the nanoparticles bind specifically to the cancerous areas instead of the normal tissue.

I have been looking at different statistics such as a simple linear correlation or something like the answer to this question: Valid method to analyze spatial correlations in images? However, I haven't found anything that would work well for correlation between images.


Edit from Ladislav Nado:
I fabricated two pictures from web…the size and resolution is equal.

Before treatment

After treatment

Best Answer

Most simplest way how to solve this in two images is extract the values from both rasters and do correlation. I am not sure if this solution will fit to your spacific case. In what "format" do you have the images? (greyscale, RGB, size, resolution...). Please give more specific details.

Two rasters in R for demonstration:

enter image description here

Values for picture A:

x <- c(1.0,1.0,1.0,1.0,0.5,0.5,0.0,0.0,0.5,0.5,
       2.0,2.0,1.5,1.5,1.0,1.0,0.5,1.0,1.0,1.0,
       2.5,2.0,2.0,2.0,2.0,1.0,1.0,1.5,2.0,2.0,
       2.5,3.0,3.0,3.0,2.5,2.0,2.0,2.0,2.5,2.5,
       2.5,3.5,4.0,3.5,2.5,2.0,2.5,3.0,3.0,3.5,
       2.5,3.5,3.5,2.5,2.0,2.5,3.0,3.5,4.0,3.5,
       2.5,3.5,3.5,3.0,3.5,4.0,4.0,4.0,3.5,2.5,
       2.5,3.5,4.0,4.0,3.5,3.5,3.0,3.0,2.5,2.0,
       2.5,3.5,3.5,3.0,2.5,2.5,2.0,2.0,2.0,1.5,
       2.0,3.0,2.5,2.0,2.0,1.5,1.5,1.5,1.0,1.0)

Values for picture B:

y <- c(rep(1, times = 10),
       rep(2, times = 6), 1, rep(2, times = 3),
       rep(2, times = 10),
       rep(3, times = 4), rep(2, times = 4), 3,3,
       3,4,4,3,2,rep(3, times = 4), 4,
       3,4,rep(3, times = 5), rep(4, times = 3),
       3,4,3,3,3,4,4,4,3,3,
       3, rep(4, times = 4), rep(3, times=4), 2,
       3,3,4,3,3,3,rep(2, times = 4),
       2,3,3,3,rep(2, times = 6))

Creation of arrays -> conversion of arrays into rasters

x_array<-array(x, dim=c(10,10))
y_array<-array(y, dim=c(10,10))
x_raster<-raster(x_array)
y_raster<-raster(y_array)

Setting color palette and plotting...

colors_x <- c("#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497",
              "#ae017e","#7a0177","#49006a")
colors_y <- c("#fff7f3","#fcc5c0","#f768a1","#ae017e")

par(mfrow=c(1,2))
plot(x_raster, col = colors_x)
plot(y_raster, col = colors_y)

...and here is the correlation

cor(x,y)
    Pearson's product-moment correlation

data:  x and y
t = 21.7031, df = 98, p-value < 2.2e-16
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 0.8686333 0.9385211
sample estimates:
      cor 
0.9098219 

Maybe there is more specialized solution to this but I think that this solution is pretty robust, simple and straightforward.

Link worth of interest: (for ImageJ) http://imagej.nih.gov/ij/plugins/intracell/index.html