Caclculate signal without background

cellprofiler

#1

Hi,

so a basic question first: I’ve read that the mean background and presumably the mean signal as well is calculated by IntegratedIntensity/area. Is that correct? Does that mean you assume the pixel intensities to be linear (no gamma curve)?
If that is the case, shouldn’t I be getting the same results if I let CP calculate the mean signal compared to if I divide the sum of IntegratedIntensity by the area for the signals (per photo)? I don’t get the same values…
I noticed it when I wanted to calculate the signal without the background. Essentially:
Sum IntegratedIntensity per photo - (mean background * area signal)
Is there anything wrong with this approach?
Is there a way to get the area for each secondary object (instead of AreaOccupied)?

Cheers


#2

Let me answer your last question first-

Is there a way to get the area for each secondary object (instead of AreaOccupied)?

Yes, use the MeasureObjectSizeShape module.

I’m not totally clear on what you’re getting at with the rest of the questions- MeanIntensity does indeed equal IntegratedIntensity/Area but I’m not really following along with your use case or why you’re doing the calculations you’re doing. Can you explain what you’re looking to calculate a bit more directly, and then we can help you find the best way to do it?


#3

Yes, use the MeasureObjectSizeShape module.

Great, thanks

Okay, so what we would like to measure is the signal of the secondary objects without the background. Therefore I was calculating:

Sum of the IntegratedIntensity of all the objects in a photo minus the mean background * the area of the objects

Which should give the signal without the background, right?

The other thing I don’t understand is the following. When I estimate the sum of the integratedIntensity Cy3 (column C) and divide it by the area of all objects (area occupied TMRM) I get a mean value of 0.0109289949 which would be the mean intensity of the signal within the photo, right? But this value is no where near the estimated mean signal from CP (Median_MeanIntensity_Cy3 with 0.0152313843)


I don’t quite understand how you’re estimating the intensity. What kind of scaling are you using?


#4

we would like to measure is the signal of the secondary objects without the background.

I still don’t know what you mean by this, I’ll need you to be more specific please. The total signal of all the pixels enclosed by secondary objects? Trying to remove camera noise/autofluorescence (what steps are you taking to measure this?) from the object measurements?

The intensity is just the intensity reported in the digital input image scaled by the bit depth to make it 0-1. There is no additional scaling unless you do it explicitly with RescaleIntensity.

I don’t know what your column C is etc, so I can’t say whether or not what you’re doing is correct. I can offer you some general advice though.

  • If you’re trying to measure the total signal in all the secondary objects, you can do this in MeasureImageAreaOccupiedIntensity using the “measure intensity enclosed by objects” option
  • If you’re trying to do some sort of illumination correction and/or background subtraction, I’d do it as an image processing step- this will be much more precise than estimation and subtraction after-the-fact.

#5

Yes, we want (ideally) the total signal of the secondary objects (or rather the tertiary, so the nuclei is not included either) with the subtracted background. I’ve attached the pipeline. I’m using MeasureObjectIntensity for the signal and MeasureImageIntensity for the background.
ImageJ seems to have this method implemented? https://www.researchgate.net/post/Measuring_signal_intensity_PER_CELL_greyscale_particle_detection
Integrated Density – (Area of selected cell X Mean fluorescence of background readings)

I’m using the MeasureImageAreaOccupied but don’t have the “measure intensity enclosed by objects” option. Is that only in CP 3.0? I’m still using 2.2, as the 3.0 is not installing on Ubuntu

So I can subtract the background within the pipeline and still use the data for quantification?

Bgd (1).cppipe (23.2 KB)
here are the example images: https://drive.google.com/open?id=1ml0qaY5u3Z8rYMdCZ8aZudy-NxKRZmpB

If I use ImageMath to subtract MaskCy3 (measurement) from Cy3 (image), I get the signals without background. Is that what you meant?
And how do I export my ImageAfterMath data? I can’t find it it in the ExportToSpreadsheet module. I only get the usual Intensities


#6

I’m using […] MeasureImageIntensity for the background

That’s fine in the theory, though I’d be very careful about precisely which measurement you’re choosing as your “background”, particularly about whether the objects will be masked out and how you can be sure you’re choosing a measurement that will be robust if some objects are missed, if there are more or fewer than expected, etc.

So I can subtract the background within the pipeline and still use the data for quantification?

You absolutely can quantify the data in processed images if you are careful to process them correctly. The first ~10 minutes of this video and this paper are good primers on some methods of illumination correction. That is routinely what we do in the lab, and I think is indeed a better strategy than doing it with math in the spreadsheet after-the-fact.

This was an error on my part, see the correction.

And how do I export my ImageAfterMath data? I can’t find it it in the ExportToSpreadsheet module.

ImageMath doesn’t make measurements, it creates an image. So you could theoretically subtract a value from an image using ImageMath and then measure in it with Measure(Object/Image)Intensity, but I’d suggest instead using CorrectIlluminationCalculate and CorrectIlluminationApply as in the paper I linked.


#7

Thank you very much for the the clarification.

I’m using the IdentifyPrimary to select ‘all bright pixel’ in the channel and mask those. The Image intensity is then measured from the unmasked area. It seems to work fairly robust across all images. Is there a problem with this?

I’ve tried to work with CorrectIllumination modules (Need CorrectIlluminationCalculate help) but I still had too much noise in the background, So @Minh suggested to use the RescaleIntensity module, which works fine. But maybe there was something wrong in the CorrectIllumination pipeline I set up?


#8

Just make this discussion simple:

Use the RescaleIntensity module. Put the value of background. For this, you just need to open the image on Cellprofiler, and put your mouse on the blank of the image. Remember this value (or average value) and rescale the intensity of the image. Then, you just substract the background.

Of course, you can also substract the background in Fiji or use MATLAB.


#9

@jedyzdc that would mean to manually set a threshold and hope it will hold for the whole pipeline (which it doesn’t).


#10

I made a couple minor tweaks to the pipeline you shared in the other post; LMK what you think.

Bgd_BCedits.cppipe (24.4 KB)


#11

Hi Beth,

the pipeline seems to identify the secondary objects better compared to the one with the RescaleIntensity module. Thank you very much! So basically, all you did was take out the Enhance module and change the Otsu classes back to two? (I’m pretty sure I’ve tried that combination as well…)
Anyway, I might stick to that one for now. Thanks a lot


#12

Yup! The thing that made the most difference was not calculating the illumination correction image on the Enhanced; it’s fine to Enhance AFTER illumination correction, but I generally always do illumination correction absolutely first or not at all.