How to compare the area in different RGB pictures?

We stained the monocytes with RGB colors, blue for nucleus, red for cytoplasm and green is the protein of interest. We want to compare the area among red, green and blue, to see the migration of the green from cytoplasm to nucleus.

For example, I use analyze>analyze particles to automatically select the cells I want in blue (first pic), then I go to the green and select the same spot/cell and use the wand to select the green area and add to the ROI manager. For this cell particularly (second pic), I can see the blue as in #8 and green as in #89. I can just measure the area manually by clicking measure but I really want to do it automatically. How do I let the program know #8 and #89 is together? so that it can output the measurement together? And output them for example, first column is the area of #8 and the second column is #89?

Thank you!


Your building blocks:

Using setResult(“Column”, row, value) you can put results in a Results table. See the function list

You can pick up a measurement outcome by getValue(“Mean, Median, Feret, etc.”) and keep that in a variable. You can do this for the “Area” of both colours.

Open images have a unique ID which you can pick up by id=getImageID() and use in selectImage(id) to activate that image.

If the box Add to Manager in the Analyze Particles dialog is set, you have all ROIs of your image available in the ROI manager after the particles were analysed. By selecting a ROI in the ROI Manager window while an image is open, that ROI is recreated on the open window.

The automated analysis:
Do the analyse particles on your blue image, then in a loop select the appropriate image, select the ROI in the ROI manager, obtain the (blue) value, repeat for the green value. setResults for both and repeat for ROI 0…(roiManager(“count”)-1), save the file as saveAs(“Text”,filepath).

Thank you. One thing I didn’t mention is, if I analyze particles in the green or red image, they would have different outcome. Because there are other noise in there with the same size range (I only limited the selection by the size), like red blood cells without the nucleus, the ROI would have more particles in red and green than the blue so the numbers/orders would be different. How will the machine know which numbers in the two or three pictures comes from the same cell/spot?

The assumption in my answer is that you use the area of the blue to measure red and green.
If you have separate areas for all three colours, you need to perform some binary logic to it first.
E.g. you threshold the blue, the red and the green separately to obtain the green binary, blue binary and red binary, call them e.g. gb, bb, rb.

Then you could decide that you want all areas which are detected in the green and the red, or in the blue. With Process > Image Calculator in two steps you first AND the red and the green, then OR that result with the blue, then do the particle analysis, discard the binary images and use the ROIs stored in the ROI Manager to extract the data from the original three-colour image.

When your images are very noisy, you may want to perform some smoothing in the image you are using to determine the ROIs, before you apply the threshold.

The method to locate the green thresholded area in the binary blue would be to set the threshold to 128 (binary images have pixel values 0 or 255), then perform a doWand step using the center of the ROI you found in the blue channel. That will select an area closest to the blue ROI, but you’ll have to check if there actually is a thresholded area selected in almost the same location. It could be that the next object to the right is selected.

How can I do it automatically on the doWand step? I know if I put my mouse on the top of the ROI numbers I can see the x and y value of the number appeared on the picture, how can I do the doWand automatically without typing the coordinate individually and manually?

You can obtain coordinates of a bounding box from the active Roi using Roi.getBounds(x, y, width, height), you can get the X and Y center by getValue("XM"),getValue("YM"), you can place the wand tool by doWand(x,y).

You do know that Plugins>Macro>Record records your actions so you can use the recorded text in a macro?