Cellprofiler imagej get raw histogram of primary objects

Dear all,
is there a way to get the raw histograms of primary objects identified in Cellprofiler?
I could not find the functionality in Cellprofiler, so I thought about using an imageJ macro to get the raw histograms of the primary objects after saving them to disk using the “SaveCroppedObjects” module from cell profiler, but then I override the cropped images, since they are all named Object-1 to Object-n and I can not store additional information such as Well or filename together with the Objects. Also if I run the imageJ macro, that produces the results table of the raw histograms for each object I can not save that back to cell profiler to be included in the results spreadsheet.
Any advice on how to solve this problem?
Thanks for the help,
Alex

Hi @alexra,

Could you clarify what your analysis goal is? What do you specifically want to get histograms of? (Raw intensity distribution for each object?)

I don’t personally know how to do that within CellProfiler, although others might have ideas. Alternatively, we may be able to help if we can better understand your goals with what you’d like to get specifically and how it will help your analysis.

Good luck!
Pearl

Hi Pearl,
thanks for your answer. The background of the analysis is to study different compaction levels based on DNA staining in cell nuclei. Treated cells show a higher degree of heterochromatin and thus an increased level of bright pixels after DNA staining. When I analyse the histograms in imageJ a get a histogram with two peaks that change position and spreading after treatment. I aim to do this analysis together in a large number of images and therefor wanted to use Cellprofiler. I usually fit the histograms in the subsequent post analysis. I hope that helps to understand.
Best wishes
Alex

Hi @alexra,

That is helpful, thanks!

I’m not exactly sure how you’re generating the histograms in ImageJ, but it sounds like you might be doing an intensity profile along a line in order to measure the intensity and position of heterochromatin in different conditions.

I can think of a couple of approaches for this problem.

One would be to create an ImageJ macro to automatically create your histograms and save them. Then you can proceed with your fitting process as usual in order to differentiate between treated and untreated. This approach will work best if you can create an automated workflow within ImageJ to generate these histograms (that is, they don’t require manual input from the user). You can learn about macros here: Introduction into Macro Programming - ImageJ

I don’t know how to generate this type of histogram in CellProfiler, but you could still use the program to try to test if there is a difference in treated vs. untreated cells. The general workflow that I would try would be:

  1. segment the nuclei using the IdentifyPrimaryObjects module
  2. add measurement modules such as MeasureObjectIntensity and MeasureObjectIntensityDistribution
  3. export the data using ExportToSpreadsheet and then test if there are differences between conditions using the software of your choice

To get started using CellProfiler for analysis, we recommend watching this CellProfiler introductory workshop, which is available on the Center for Open Bioimage Analysis YouTube Channel. You can download the corresponding written tutorial on Translocation from the CellProfiler Github page. Once you get started building a pipeline to analyze your images, if you have questions, please do reach back out on the forum.

Good luck!

Hi Pearl,
thanks for your suggestions. I tried this already, but this is analysis is not compatible with my previous analysis. So to be sure I did not miss anything:

  • I can not use CP to export individual PrimaryObjects with a file name that corresponds to some metadata (e.g. Well-ID-Image01.tif)
  • I can not get numerical values back from imageJ into a running CP pipeline?

Thanks again for your suggestions.
Best wishes
Alex

As far as the histogram, what are you actually making a histogram of? The pixel values within the whole image, the pixel values within the individual objects, the mean pixel value of each object, is it a line profile as @pearl-ryder hypothesized, etc? Some of these CellProfiler may be a direct replacement for, and some not. Even if it is not a direct replacement, depending on the exact nature of your biological question and the exact measurement you are doing now, the measurements from CellProfiler MAY (or may not, without knowing your current measurement and your exact question I can’t say) end up being a better measure of your biology than what you’re currently getting in ImageJ; % area of the nucleus that is heterochromatin spots is something you could do pretty easily in a CellProfiler pipeline but may or may not be directly calculable from your ImageJ workflow.

  • I can not use CP to export individual PrimaryObjects with a file name that corresponds to some metadata (e.g. Well-ID-Image01.tif)

Nope, not true! Any piece of metadata extracted in the Metadata module can be used in file and/or names (in SaveCroppedObjects or other File export module). Typically you just have to right click or control click in the box to get the list of Metadata things to use.

  • I can not get numerical values back from imageJ into a running CP pipeline?

It depends a bit what you mean by this:

  • If you mean can you create a workflow where CellProfiler does some preprocessing, the result is then sent to ImageJ, and a number is pulled back into CellProfiler and processing continues, then no, not currently possible- the RunImageJMacro is designed to only pull back images from ImageJ, not numerical data, though that may change in our next release based on some work our team is doing now.
  • If you mean can you calculate a value in ImageJ first on a per-image level and then feed the value into CellProfiler for use later, then yes, this is possible, using the Metadata module (you’d import your ImageJ calculated values as a CSV).

Hi Beth,
thanks for your replay. Your first hint did the trick. I was not aware of the Metadata extension in the SaveCroppedObjects. That now generates a subfolder for each well containing the cropped nuclei that I then can batch process in my usual way and combine the results from CP and image J based on the Well / object number.
I am waiting for the new version where numerical data from IJ can be send back to CP.
Thanks for the help.
Best wishes
Alex

What exactly are you doing to create this histogram in ImageJ (I still am not sure what exactly it is a histogram of)? If it’s drawing a line profile, it is possible that it won’t work in the next version either (at least not easily), since I dont’ know if the changes being made will support manual interaction with the images or not.