Cellprofiler relate objects that are not touching

Quick question,
I have a vacuole and the plasma membrane as objects in my cellprofiler pipeline and need them to be related for analysis. But, since they aren’t touching this can’t be done simply. Any ideas?

update: Clarification: I need to measure the intensity within the vacuole and PM, so any changes to those objects would need to be undone before measurements are taken.

Thanks
example: Vacuole inside PM

I recommend you expand the smaller, enclosed objects by a few pixels (using ExpandOrShrink), then use Relate module to relate the now-overlapping objects.

Anne’s recommendation should definitely work but just in case you want another option, I had a similar project to this and I worked it out by running IdentifyPrimaryObjects twice. One where I didn’t used the “Fill holes” parameter and one where I didn’t.

This meant I had ring shapes and then filled in ring shapes. The first I used to measure and the second I use to relate the object with stuff inside.

1 Like

The only trouble i have with that is that the vacuoles would then be too large and shrinking them back down would remove the relationship

update: if you give them the same name the relationships are maintained, so this’ll work
second update: okay giving them the same name does not work

The enlarged objects should have the same object number as the original objects.

Thus, when you have the output tables at the end you can use the enlarged objects for the object relationships and the original objects for whatever other measurements you want to relate.

I’m not sure whether it is feasible for the segmentation, but a better approch would be to identigy the nuclei as primary objects, secondary objects for the whole cytoplasm and tertiary object for the vacuoles.

1 Like

Will this affect the math module and make sure that the vacuole intensity is always divided by the plasma membrane intensity?

I did do that actually, the problem still persists, as the math module does not make sure the vacuole intensity being divided is inside the plasma membrane, whose intensity it is being divided by.

I’m not sure I understand totally.

It might help if you upload your pipeline and an example image to run on it.

Lemme post an example:


So, vacuole 4 has a parent of cell 5, but vacuole 4’s intensity is being divided by cell 4’s intensity and not cell 5’s intensity.

Okay, I have done my own test and confirmed I get the same behaviour. This does remind me of my post in your other thread because I did think that it wasn’t possible to calculate maths using related objects. I was thinking of a case where there were multiple children but the point about objects kind of holds.

The issue is despite the fact your two object sets are “related” now, actually what happens is a third object set is created which really just contains the relationships between the parents and children. Your two original object sets which have been measured are unchanged by the RelateObjects module so the result would be the same if you did the math before or after this module. So it just divides them by their object numbers.

I’m trying to think of a way to get around this. It seems like something that might have come up before on the forum but so far my searching hasn’t worked.

Do all your cells have both a vacuole and a plasma membrane? If so you could maybe try using “IdentifyPrimaryObjects” and “IdentifySecondaryObjects” instead as the math will work this way.

Okay, I’ve worked it out thanks to this

I did remember there previously being a module for relabeling objects and it is certainly not where I would go looking for it… but the solution is now in “SplitorMergeObjects”

You need to set it up so the input objects are your vacuoles and set it to “Merge” “Per-Parent” and the parent objects are your cells.

The result is a new object set which is basically your children objects but their object numbers are now the same as their parents objects.

I’ve tested it out and the CalculateMath works now.

Good luck.

1 Like

ok ill try that out
thanks!
edit: Could I see what you did in the pipeline? I’m having a bit of trouble following your instructions.
pipeline: yeastcellPMsegment2.cpproj (559.0 KB)

I can give it a try!

Could you provide a sample image set that you are trying to run the pipeline on?

Mask:
9Arrdel_Aqr1_001.nd2 - C=2mask.tiff (4.0 MB)
Nd2 stack:
https://file.io/QTK2Z2

THanks for the help!

Hi @mdl54,

Sorry for the late reply! Remembered and came back to look at it now but can’t access your ND2 stack. I’m assuming you put a time limit on sharing the file? Can I have a second chance? :slight_smile: