8
$\begingroup$

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

$\endgroup$
8
  • $\begingroup$ I think you should augment your question with some examplar images. Picture says a thousand words... and it would give anyone who would like to help you some test data to work with. $\endgroup$
    – TooTone
    Commented Mar 14, 2014 at 23:37
  • $\begingroup$ So, the things that look like stars are gold particles, adn the green and yellow things are blood vessels? Or am I misunderstanding? $\endgroup$ Commented Mar 19, 2014 at 14:39
  • $\begingroup$ Its fabricated in Photoshop :). Let suppose that red area are cancer, and yellow areas on picture below are gold particles which are "glued" on cancer areas. I really do not have nay background in medicine research... $\endgroup$ Commented Mar 19, 2014 at 15:05
  • $\begingroup$ Question is whether gold particles correlate with cancer areas. $\endgroup$ Commented Mar 19, 2014 at 15:17
  • $\begingroup$ Is this really what the images look like? If so, I think that creating fills of the areas by color and calculating proportion of area overlap would be a very decent estimate. In the case above, one fill could be created by a simple, enhanced, red color channel, and the other from a yellow color channel. $\endgroup$ Commented Mar 19, 2014 at 17:07

4 Answers 4

6
$\begingroup$

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

$\endgroup$
9
  • 1
    $\begingroup$ Although simple and straightforward, the robustness of this solution is questionable: it assumes that the gold particles and vessels will be located at identical parts of the images when the particles are within the vessels. If, for instance, one image is just slightly rotated, shifted, or expanded relative to the other, then the correlation can be completely changed--even its sign can change. $\endgroup$
    – whuber
    Commented Mar 12, 2014 at 16:24
  • 1
    $\begingroup$ I fully agree. @WanderingSophist wrote that locations of gold nanoparticles and the locations of the blood vessels are visible in the SAME tissue sample. Therefore I assume that it would be possible to make two pictures of identical size without rotation or shift. $\endgroup$ Commented Mar 12, 2014 at 16:35
  • $\begingroup$ The images are in RGB format, 1392 x 1040. There should not be any need to account for shifting the images; the field of view is exactly the same for each of the pairs of images. One image is taken with darkfield microscopy to make the nanoparticles visible, and the other image is taken using a fluorescent dye that reveals the blood vessels. $\endgroup$ Commented Mar 12, 2014 at 19:34
  • $\begingroup$ @LadislavNado I am having trouble understanding your proposed method, mainly because I am unfamiliar with R and the usage of rasters. Would this be equivalent to turning the matrices with the RGB values into vectors and doing a linear correlation between them? $\endgroup$ Commented Mar 12, 2014 at 19:40
  • 1
    $\begingroup$ In image processing is common to account for transformations, by modelling them (nicely analyzed in this paper yann.lecun.com/exdb/publis/pdf/simard-00.pdf). The idea is to consider a set of possible transformations, and look for the combination of them which delivers the closest image to the reference. There are plenty of other approches. But that is the basic intuition. You may look for topics like registration, active shape models or template matching. $\endgroup$
    – jpmuc
    Commented Mar 15, 2014 at 11:26
6
+50
$\begingroup$

This is a problem that has been analyzed most extensively in the field of astronomy or cosmology with things like galaxy spatial correlation functions. The short answer is that you probably want to compute a 2D correlation function which can be computed efficiently with the Fast Fourier Transform (if needed). You might also want to Google terms like the Landy-Szalay estimator which allows treatment of masked-out areas and boundaries.

It sounds like you also want to compute uncertainties or confidence intervals. This is a little trickier. In astronomy it has been estimated with Jack-knife techniques though I think it still lacks a rigorous foundation. Using Monte Carlo techniques is often useful for this as well but is also not entirely on a rigorous foundation either.

$\endgroup$
2
  • $\begingroup$ Thank you for your response. Could you please provide a small demonstrative example? I would prefer R code (but others are welcome too). I want to award +100 rep. to a working example. $\endgroup$ Commented Mar 17, 2014 at 7:31
  • $\begingroup$ Let's continue in chat. Might get to this tomorrow. $\endgroup$
    – Dave31415
    Commented Mar 17, 2014 at 17:34
1
$\begingroup$

You could manually trace the centerline or the walls of the blood vessels (or use machine learning to fill those areas. Then you could build a buffer fence around that area. As a second step, you could identify the particles on the image (either manually or by machine learning). Then you could calculate the statistics related to then number of nanoparticles inside the filled area of the buffer fence vs outside of it.

With fifty pairs of images, it might be faster and more accurate to draw the buffer fences and measure the number of particles in and out, manually.

$\endgroup$
3
  • 1
    $\begingroup$ Thank you for your response. Could you please provide a small demonstrative example? I would prefer R code (but others are welcome too). I want to award +100 rep. to a working example. $\endgroup$ Commented Mar 17, 2014 at 7:30
  • $\begingroup$ Can we get an example of your data? $\endgroup$ Commented Mar 19, 2014 at 3:03
  • 1
    $\begingroup$ I've added some fabricated pictures (RGB, equal size and resolution). $\endgroup$ Commented Mar 19, 2014 at 11:01
-1
$\begingroup$

Please see the R package SpatialPack. There you will find three different statistical approaches to address this problem

$\endgroup$
1
  • $\begingroup$ Welcome to Cross Validated! Please take a moment to view our tour. It is preferred that answers are sufficiently long to address the question and are completely self-contained. Will you please expand on your answer and provide details about how SpatialPack addresses the question? $\endgroup$
    – Tavrock
    Commented Mar 12, 2017 at 21:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.