I have a series of microscopy RGB images of the cell nucleus like this one

enter image description here

The red and green dots are clusters of different proteins and I would like to determine when these dots colocalize.

Through many examples I was able to assemble this code that given the image i, extracts the red channel, determines the foci correlating the channel image with a Gaussian kernel and then isolates the foci positions through WatershedComponents[] and ComponentMeasurments[].

At the end I visualize the foci and store their coordinates in the variable "myCoordFoci"

adj = ImageAdjust[i];
rgb = {r, g, b} = ColorSeparate[i];
currentImage = r
fociMask = ColorNegate[Binarize[ImageCorrelate[currentImage, 
                       GaussianMatrix[2],NormalizedSquaredEuclideanDistance], .31]]
distT = DistanceTransform[fociMask, Padding -> 0];
distAdj = Map[ImageAdjust, %];
marker = MaxDetect[%, .1];
watershed = WatershedComponents[GradientFilter[fociMask, 2], marker, Method -> "Watershed"];
myFoci = SelectComponents[watershed, "Count", 0 < # < 50 &];
myMeasures = ComponentMeasurements[myFoci, {"Centroid", "Label"}];
myMarkedFociImage = Show[currentImage,
  Graphics[{Red, Text["+", #] & /@ (myMeasures[[All, 2, 1]])}]]
  myCoordFoci = myMeasures[[All, 2, 1]];

Probably this is a very ugly and inefficient way to do it, but it works - nevertheless I'm open to suggestions!

My problem is:

Now that I have the coordinates for the red and green foci, how could I determine if some foci colocalize with others?

  • 1
    $\begingroup$ Have you seen PearsonCorrelationTest[]? $\endgroup$ – Dr. belisarius Nov 10 '14 at 19:27
  • $\begingroup$ Could you include an example image ? $\endgroup$ – lalmei Oct 13 '15 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.