convert cell segmentation results to a table of intensity values

Viewed 203

I am trying to segment a multiplexed cell imaging dataset. You usually get a 2D array of predicted cell/nucleus labels as the result. A figure to illustrate the input and output:

enter image description here

The next step is to quantify the intensities for each antibody/stain for each cell. Somehow I did not see that aspect discussed in any of the tutorials. Is there a proper way of doing that?

Update: There appears to be some confusion what the data represents. In the example image, you are trying to identify individual cells. Each blob is a cell. Every cell gets a different label. The predictions are colored by label. You want to determine how bright each cell is. Here is an example workflow.

2 Answers

If you have an [x, y] array for each label iterate over it computing the mean of bright intensities of pixels in the original image.

for label in array:
    intensities = []
    for coordinate in label:
        intensities.append(original_image[coordinate[0], coordinate[1]])
    cell_bright = np.mean(intensities)
    # Use or store cell_bright

You can use skimage.measure.regionprops_table.

import pandas as pd
from skimage import measure

res = measure.regionprops_table(label_image, intensity_image, properties = ['intensity_mean'])
resdf = pd.DataFrame(res)
Related