Measuring fraction of label in yeast membrane


#1

Hi - I am trying to use CP to measure the fraction of fluorescence from an RFP labelled protein that is in the plasma membrane (PM) of yeast cells. In my experiments the protein relocalizes from the PM to the cytosol and vice-versa depending on various treatments. The cells also expressed a cytosolic GFP. I want to use the GFP signal (which is always cytosolic) to create an outline, then use this outline to measure the fraction of RFP fluorescence in the PM.

Following Mark Bray advice I made the pipeline attached. It uses the following modules:

LoadImages: Load the RFP and GFP images
IdentifyPrimaryObjects: Identify the cells from the GFP image.
MeasureRadialDistribution: This module divides the object into a set of radial bins (sort of like concentric circles from the cell center to the cell perimeter), and then measures the intensity within each bin. One of the measurements made is the fraction of the total stain (RFP) in a given bin, for each bin (FracAtD)
ExportToSpreadsheet: Export the cell measurements to a csv.

I have also added an “ExpandObject” command, but this is not important now.

I attached images of the outlines I get, superimposed on the RFP and GFP images. As you can see in the RFP overlay, the outlines is often well aligned with the fluorescence ring in the PM, but in too many cells it is not. In those same cells it is also not tracking very well the border of the GFP fluorescence.

It would seem that the outline could be much better than this, based on the nice contrast of the GFP images. I thought maybe changing parameters could get what I want. Maybe the choice of thresholding method and its parameters is key. There are so many there and I don’t know which should work best for this. Any help would be appreciated.

I used Otsu Global-Two clasess-Weigthed variance with Threshold CF 1, 0 and 1 boundaries to generate these images.

Thank you,

Gustavo

OverlayOutlinesGFP.pdf (151 KB)
OverlayOutlinesRFP.pdf (133 KB)

membrane-pipeline.cp (4.47 KB)


How speed up my pipeline (beginner)? What computer to buy?
#2

Hi Gustavo,
Could you upload the actual raw GFP and RFP images instead of PDFs?
Thanks!
-Mark


#3

Hi Mark - I uploaded the TIFF files now. Thanks for any tips!

Gustavo





#4

Hi Gustavo,

I would suggest making the following changes:

  • Thresholding method: Otsu 3-class with middle class set to background
  • Method to distinguish clumped objects: Intensity
  • Method to draw dividing lines: Intensity
  • Automaticall calculate smoothing filter size: Uncheck the box
  • Size of smoothing filter: 3

Also, you can use ExpandOrShrinkObjects to expand/shrink the detected objects by a certain number of pixels so you can better match the RFP outline, if needed.

Regards,
-Mark


#5

Hi Mark,

This worked very, very well. I had goofed around with the other options and never gotten this good. Thank you! I uploaded the outlines.

A few cells remain “clumped” in this processing. I tried using “Method to distinguish clumped objects: Shape”. This worked better for a couple of them, a nice line contoured the neck of two cells that had been previously conjoined, the line nicely traced the membrane stain. I uploaded the results, the files are called “shape-split” in the end. Unfortunately “shape” conjoined some cells that “intensity” had split well. I tried “Laplacian of Gaussian” with “LoG”=5. It did very good splits, but the contours had funny “bitten bits”, like little bays in them (files: Lapl-5"). Then I switched the un-clumping to “Propagate”, it was bad first, but worked very well with LoG=15 (files: Lapl-15-propagate). All clumps were properly split. Unfortunately the “split lines” were straight lines, while the ones traced by “intensity” followed the contour of the cell membrane. The straight lines are not too bad though, overall this seems best by now.

I tested the parameters sort of blindly, reading the help opened by the “?” buttons. A more educated trial may work better, I would appreciate any tips. The goal is to get the outlines to trace all the membranes in the images (membranes = cell contours with RFP label).

I will now see what the values are using these outlines. Planning to use expand object by 1-2 pixels, and shrink object by 1-2 pixels. Then obtain the total fluorescence in both new objects and use the difference as a measure of membrane fluorescence.

RE: the data output in the .csv files. I noted that the “objects” (cells) are numbered and their X, Y coordinates are provided. That would be helpful aid to locate the cells. For further help, is it possible to get the object numbers printed inside the cell contours?

Thanks for all your help, it seems that Cell Profiler will get the measurements that I need, it’s great!

Regards,

Gustavo

You didn’t state a preference between Weigted Variance and Entropy for what is Otsu minimizing. I did it all with variance, I tried entropy and it worked very poorly.
OverlayOutlinesRFP-with-Lapl-5-split.pdf (685 KB)
OverlayOutlinesGFP-with-Lapl-5-split.pdf (561 KB)
OverlayOutlinesGFP-with-Lapl-15-split_propagate.pdf (683 KB)
OverlayOutlinesRFP-with-Lapl-15-split_propagate.pdf (548 KB)
OverlayOutlinesRFP-with-shape-split.pdf (559 KB)
OverlayOutlinesGFP-with-shape-split.pdf (683 KB)
OverlayOutlinesRFP.pdf (560 KB)
OverlayOutlinesGFP.pdf (683 KB)


#6

Based on the settings you tried, I don’t think I have anymore tips. The Laplacian of Gaussian is supposed to be really good at detecting blobs of varying intensity, but the performance seems to be quite sensitive to the settings chosen, so I wouldn’t be surprised if you’ve done as well as you can do.

You can use the DisplayDataOnImage module for this. Select the image you want to overlay, Number as the measurement category and Object_Number as the measurement.

Almost invariably, I use Variance. I have yet to see a case where Entropy works well.
-Mark


#7

Hi Mark - Thank you. A couple questions:

You can use the DisplayDataOnImage module for this. Select the image you want to overlay, Number as the measurement category and Object_Number as the measurement.

I tried the DisplayDataOnImage module. Problem: the options in Measurement Category do not include “Number” as an option in my Cell Profiler. None of the options included “Object_Number” as the measurement. I tried “count”, but that just displayed the total number of cells in the middle of the image.

RE: measuring membrane fluorescence. I now generated an outline shrunk by 2 pixels and one expanded by 2 pixels. Q: Does the fluorescence value extracted with the outlines include the pixels in the outline? Or only those internal to them?

RE: same topic. I often need to inspect the images closely, zooming in and checking individual pixels. This is hard to using the displays provided as output. I would like to look at them in ImageJ. Can the outlines overlaid onto the images be generated in TIF format or any format would let me do this?

Thank you again, I am getting there!

Gus


#8

Sorry, I should have clarified that you need to select “Object” as the type of measurement to display, and select the object that you want to use.

Both, in a way. The MeasureRadialDistribution module divides the object into bins. So the outermost bin includes the object edge, but the outermost bin will be of some thickness (the thickness depending on the # of bins you specify) and the measurements from that bin will be an aggregate of those pixels, i.e., the outer edge and some pixels interior to it.

Alternately, you can also measure the florescence from just the membrane by using MeasureObjectIntensity, since one of the measurements it generates is the mean and integrated intensity along the object edge.

You can use OverlayOutlines to overlay the outlines from an Identify module onto the image of your choice and use SaveImages to save it to the format of your choice.
-Mark


#9

Hi Mark – Thank you. I got the numbers to display over every cell now.

I could not get SaveImage to work, though. I get this error: “ImportError: The _imaging C module is not installed”. I use Mac OS X 10.5.8. I uploaded my newest pipeline.

For my measurements of “fraction of fluorescence” in the membrane I ended up disfavoring “MeasureRadialDistribution”. I did not like that it splits the cell in a fixed number of bins. That means that for bigger cells the bin with the membrane is wider than in smaller cells. However, the plasma membrane has the same thickness in all cells.

I wanted a regular thickness in my plasma membrane fraction, centered in the outline obtained on the GFP. So I am now using an Expanded Outine and a Shrunk Outline. +2 and -2 pixels and will subtract one Shrunk from Expanded to get the membrane fraction. I traced a few cell profiles in ImageJ and the peak of fluorescence in the membrane of the RFP images is 4-5 pixels wide, so I thought this should work.

I am going on the assumption that the IntegratedIntensity value includes the pixels of the outline. Please confirm.

I want subtract the background. Thought of subtracting (area (pixels) * background per pixel) to IntegratedIntensity for each cell. Area did not appear in the measured values, so I calculated it dividing the total intensity by the mean intensity (is there way to directly obtain the area from CP?). For the background I have used before the “most common pixel” in the image, which in my images typically corresponds to the median background value (technically the mode, but they typically coincide). Is there a way of getting this background value from Cell Profiler? Or any other measure of per-pixel background, like “average value of lowest intensity 1 percentile”?

Also, I see that the fluorescence values displayed in .csv files are normalized to maximum possible. For some applications I would like to use the raw values, not normalized to anything. Can that be set?

To use the background value I obtained from ImageJ I needed to make it compatible with the values in the .cvs files by applying the same normalization. I divided the value by 2^16 (65536). Is this correct?

Thank you!

Gustavo
membrane-pipeline-3.cp (9.57 KB)


#10

I think a better approach is to do what you have, then use MaskObjects with the expanded cells as the input, the shrunken cells as the masking objects, and inverting the mask. This will leave a ring around each object that you can use for measurement.

If you use the approach I detailed above, it will.

I think there are a couple of straightforward ways you can do this:

  • Use illumination correction to remove the background then make measurements on the corrected image. You can use the CorrectIlluminationCalculate module with the method set to “Background”, rescale set to “no” and “Calculate function for…” set to “Each”. I would suggest using a median filter in this module to find the background, but it may take some exploration to find a proper filter size (“Fit polynomial” can also do as a filter in a pinch). Then use CorrectIlluminationApply with the application as “Subtract”
  • Alternately, you can use MaskImage on the GFP (and RFP) image with the detected cells as masking objects and inverting the mask. This will leave you with the background as the region of interest, and you can use MeasureImageIntensity to get the mean/median of the background.You can then use CalculateMath to subtract the per-image median background intensity from the per-object integrated intensity to get a per-object corrected intensity.

The benefit of the former approach is that all measurements are done on the prior corrected image; however, the illumination function can be a bit tricky to get right. The benefit of the latter approach is that its easy to calculate but you can only apply the correction factor to one measurement at a time via CalculateMath.

Regards,
-Mark


#11

Hi Mark - Thank you, this is being very helpful. For the background subtraction I liked better the MaskImage approach you suggested. I tried now and I got it to work. What I did was to subtract the median intensity of the background mask from the mean intensity of the object (in the example I implemented so far, the object is the ExpandedCell, all in the RFP image). Then I multiplied the result by the total area of the object. Because total are is not provided (or is it?) I calculated it using CalculateMath, by dividing IntegratedIntensity by MeanIntensity. The resulting “RFP minus background” results seem coherent with what I can estimate by looking at the images and rapid calculations using ImageJ. I think this works. Let me know if you see any issues so far.

I uploaded my current pipeline.

I still have trouble using SaveImage, as posted earlier.

I like the Mask approach you suggested for calculating membrane intensity.It seems that it is better than what I had been doing because with the mask you know you are including all the pixels. Please confirm. I will try the approach on Monday, it looks straightforward.

Thank you again, have a nice week end, regards,

Gustavo
membrane-pipeline-4.cp (14.2 KB)


#12

I’m not sure about this step. It might be more straightforward to use ImageMath to subtract the median RFP intensity from the RFP image on a per-pixel basis and then use MeasureObjectIntensity/MeasureImageIntensity on the result.

You can obtain the area of any object using the MeasureObjectSizeShape module.

I will need to check into this one.

That’s correct.

Regards,
-Mark


#13

If you set the file format to TIF and the image bit-depth to 16, do you still get this error?
-Mark


#14

Hi Mark - The “fraction in membrane” pipeline runs smoothly. I still need to plot the data, but I have had no more problems with running it and getting a spreadsheet with everything I selected.

I still cannot save the images though. In your previous post you asked if using “TIF” format and 16 bit solved the problem. When I do that I the “image bit depth” words appear red, indicating an “error”.

I tried setting it to “png”. Then it doesn’t show the red lettering but it stops the run with this error message (copied from error window clicking “copy”, though this does not show in there):

Traceback (most recent call last):
File “/Applications/CellProfiler2.0.app/Contents/Resources/lib/python2.7/cellprofiler/pipeline.py”, line 309, in run
File “/Applications/CellProfiler2.0.app/Contents/Resources/lib/python2.7/cellprofiler/modules/saveimages.py”, line 445, in run
File “/Applications/CellProfiler2.0.app/Contents/Resources/lib/python2.7/cellprofiler/modules/saveimages.py”, line 489, in run_image
File “/Applications/CellProfiler2.0.app/Contents/Resources/lib/python2.7/cellprofiler/modules/saveimages.py”, line 904, in save_image
File “PIL/Image.pyc”, line 1902, in fromarray
File “PIL/Image.pyc”, line 1858, in frombuffer
File “PIL/Image.pyc”, line 1796, in fromstring
File “PIL/Image.pyc”, line 1763, in new
File “PIL/Image.pyc”, line 37, in getattr
ImportError: The _imaging C module is not installed

What I want is to have these images saved:

GFP with outlines
RFP with outlines
RFP with membrane rings

Thank you for any advice.

Also, I notice one can use ImageJ inside CP. I am comfortable with ImageJ. It that interface could be used to generate a stack with the 180 image I am running in this experiment, that would be perfect.

Thank you!!!

Gustavo
membrane-pipeline-100313b.cp (15.3 KB)


#15

[quote=“gus_pesce”]
Traceback (most recent call last):
File “/Applications/CellProfiler2.0.app/Contents/Resources/lib/python2.7/cellprofiler/pipeline.py”, line 309, in run
File “/Applications/CellProfiler2.0.app/Contents/Resources/lib/python2.7/cellprofiler/modules/saveimages.py”, line 445, in run
File “/Applications/CellProfiler2.0.app/Contents/Resources/lib/python2.7/cellprofiler/modules/saveimages.py”, line 489, in run_image
File “/Applications/CellProfiler2.0.app/Contents/Resources/lib/python2.7/cellprofiler/modules/saveimages.py”, line 904, in save_image
File “PIL/Image.pyc”, line 1902, in fromarray
File “PIL/Image.pyc”, line 1858, in frombuffer
File “PIL/Image.pyc”, line 1796, in fromstring
File “PIL/Image.pyc”, line 1763, in new
File “PIL/Image.pyc”, line 37, in getattr
ImportError: The _imaging C module is not installed[/quote]

I’ll refer you to this post for a possible solution. I should mention that you should download version 2.0 from the trunk build page and not 2.1.
-Mark


#16

I’m not quite sure what you mean here? Are you referring to collapsing each flex file to a single image for each channel by taking the Z-projection or some such?

In any case, we have an sample pipeline on our Examples page, at this entry describing how to use ImageJ plugins in conjunction with CellProfiler.
-Mark


#17

Hi Mark - Thank you. I think I understand what I should do, but just in case, let me make sure.

I should download CellProfiler_2.0_r20130822195819.dmg from cellprofiler.org/cgi-bin/trunk_build.cgi.

That will be now my “Cell Profiler”. It will do everything as the one I have now, with the added benefit that some bugs, including this with “SaveImage” will have been fixed.

My pipelines will work in the new cell profiler as they are.

I don’t know what “trunk-build” means, but it sounds that is some refashioned version of the software with added capabilities, perhaps for specific applications. So my new cell profiler will allow to do new things that I probably don’t need, but what I do need is the bugs having been fixed, which happened during the building of the trunk, so to speak.

Please let me know if I got the ballpark right. What do I do with the old cell profiler? Just delete it or is there an uninstall protocol?

Thank you!


#18

[quote=“gus_pesce”]
I should download CellProfiler_2.0_r20130822195819.dmg from cellprofiler.org/cgi-bin/trunk_build.cgi.

That will be now my “Cell Profiler”. It will do everything as the one I have now, with the added benefit that some bugs, including this with “SaveImage” will have been fixed.

My pipelines will work in the new cell profiler as they are.[/quote]

Yes, that’s all correct. :smiley: However, keep in mind that if you make a pipeline with the newer version and then decide to fall back to the old version of CP for some reason, you cannot use the new pipeline with the old version. In other words, CP is backward-compatible but not forward-compatible.

“Trunk build” is the generic term for an application that is constructed (i.e., “built”) from source code that is under version control (which allows us to roll-back changes easily); the “trunk” is the code that is undergoing development.

So you’re partly right: This version has all our bug fixes from the last release until now, and has some new features added as well. The idea is that the upcoming release will be the final version of this build available to the public. Does that clarify things?

I think you can just remove the old app to the Trash if you want only one copy around.

Regards,
-Mark


#19

Thank you Mark, that clarifies things.

My pipeline works now. I obtain values for fraction of label in the membrane “ring” for all cells in each image.

I would like now to be able to track the values in the same cells, in a time course series. In my experiment the cells are attached to glass and are imaged repeatedly over time. They remain in place, but may wiggle or swing a bit. Are there straightforward ways to get CP to track single cells in a time course?

Thank you,

Gustavo


#20

Hi Mark - The new “trunk build” is not opening in my Mac. I get message saying: “Cell Profiler has encountered a fatal error. It will now terminate”.

I downladed the new version from this link: CellProfiler_2.0_r20130822195819.dmg. I dragged the cell profiler 2.0 icon from the disk image to my “Applications” folder. It said “Replace Cell Profiler 2.0?” and I said yes.

Thank you for helping out,

Gustavo