Problem with CellProfiler "SaveCroppedObjects": can't analyze multiple images at the same time


I am very new to CellProfiler, and I started using it to segment cells based on membrane fluorescence and nuclei. For that, I previously generate labelled nuclei images in FIJI (which I can manually correct easily), and I import them as objects into CellProfiler. I use these as “primary objects” to identify “secondary objects” in the membrane fluorescence image. Then, I can use the “SaveCroppedObjects” and save the individual masks as separate files in an output folder. I can later import these masks altogether into FIJI as image sequence, erode them, Z-project them, and I end up with a binary mask of the cells that I can add to the ROI manager. I like this strategy since I can easily manually correct a ROI if it is not OK. This has worked wonderfully for pairs of images (nuclei+membrane):

The problem is when I want to analyze multiple pairs of images at the same time. The pair of images share a numbering scheme, which seems automatically detected by CellProfiler:

I would like to have the individual masks of each pair of input images stored in a separate folder. However, in the SaveCroppedObjects window I can only specify one location, and the individual masks, which are named, for example, “Celula 1”, “Celula 2”, etc, get overwritten between the pair of images. At the end, I end up only with the individual masks of the last pair of images analyzed. Thus, currently I have to run CellProfiler for each image pair individually, which is very inefficient and time consuming.

If anyone could advice me on how to solve this, I would be very much greatful!


1 Like

I just encountered the exact same problem. I am trying the “run multiple pipeline” option but no luck yet. Hope there’s a solution.


1 Like

a simple-not so simple solution would be to run cp from a script one ‘pair’ at a time. then you could rename the celula’s or the folder they are in after each run. the simple part would be the script, the not so simple part is using cp in this fashion. not actually that hard once you’ve done it, but another layer of stuff to learn if you are just now jumping into cp.

so, if I get what you are saying, you export from cp each cell as a little image/mask and then import all those back into imagej in one stack with all the masks on top of one another? Why? Why not save the whole mask of the cells and move that back into imagej for further analysis?

1 Like

Hi @johnmc, thanks for your answer! Yes, I realize now that that is actually so much simpler. Just exporting the labelled image and opening it back in FIJI. I am trying to find how exactly to do that. I am guessing it is super easy, but so far haven’t been able to do it. I have the labeles and other images in this window. Tried with the “save images” module, but could not get the labels. Any hints? Thanks again!

try this:

then save as a 16bit tiff and the number of the object will be the grayscale value when you open it in imageJ:

1 Like

That is exactly what I wanted. Worked perfectly!!
(changed the label colors with “set label map” of MorpholibJ in FIJI)
Thanks a million!

PS, in case somebody finds it useful: I added a module in CellProfiler so that there is a 2 pixel separation between the “cell” objects (1 pixel didn’t work very well). I can then make a binary mask from the labels in FIJI (adjust threshold) and run the analyze particles. That way, I can have the ROIs in the roi manager, in case I want to edit a “cell” ROI manually. I can re convert the “tuned” masks/ROIs into labels either with the connected components tool from MorpholibJ or with the Roi Map tool, respectively. Maybe there are easier way, but this seems to work.


Hi waisman,

Here is an another solution for your problem with slight modification in your pipeline to get just a masks of individual cells as seperate masks. Before your “savecroppedobjects” module add “maskobjects” module and chose the option as in the screenshot. Its save the individual masks. In Fiji you can directly add as a ROI.

  1. This is the sample cell segmentation,

  1. Mask objects,

  2. Savecropped objects

  3. Saved output individual masks

Pipeline here,
ExampleHuman.cpproj (1.1 MB)

Fujfilm Wako Automation (Consultant)

1 Like