Is it possible to assign object numbers from objects A to B?

Hi guys,

With my pipeline I am measuring two different intensities (2 different kinds of objects) per cell that I want to ratio to each other. The problem I run into is that in the end in my excel file both objects are numbered separately. Ideally I would like to have objects A numbered from for example 1 to 9 and the, for example, 4 objects B (most of the time there are less objects B than objects A) numbered: 2, 6, 7 and 9. Basically I want both objects on the same row in the output file for easier processing.

What I get now:
Image ObjectA ObjectB Parent of B …
1 1 1 2
1 2 2 6
1 3 3 7
1 4 4 9
1 5 nan nan
1 6 nan nan
1 7 nan nan
1 8 nan nan
1 9 nan nan

What I would like:
Image ObjectA ObjectB …
1 1 nan
1 2 2
1 3 nan
1 4 nan
1 5 nan
1 6 6
1 7 7
1 8 nan
1 9 9

I spent a lot of time on this, but I can’t seem to get it to work. The best I can get is to get a parent number for object B. Which already helps because now I can manually link them, but if possible I would like to have both the linked objects A and B on the same row in the excel file as I show above. Do you think that is possible?

Thanks in advance!

Hi Bas,

I don’t think there’s a way to do precisely what you’re looking for, at least in an arbitrary way. The only way to establish such a relationship between disparate sets of objects is through parent/child relationships (which it seems like you’re already trying to do?), but these only take certain forms:

  • Primary/secondary/tertiary: These are guaranteed to be 1:1:1 for the objects in question.
  • RelateObjects, ReassignObjectNumbers: This establishes many-to-one relationships but the resultant objects will physically overlap with the parents.
  • MaskObjects: This is also 1:1 and also results in physical overlap, but you have some control over which objects make the cut (more so than RelateObjects), and you can control how the resultant objects are renumbered.
  • FilterObjects: Also 1:1 but does not require physical overlap, just the appropriate measurement to be made.

So the main question is: Do objects A and B physically overlap or not? If so, there may be some creative way to make this happen; if not, then probably not.


Hi Mark, thanks for your reply.

Am I correct when I say that IdentifySecondaryObjects only finds objects outside of the primary objects? Because if there is a way around that it could work I think. My primary objects are circles in which there is either 1 or no secondary object. What would be perfect is to use IdentifySecondaryObjects to identify them by thresholding within each of these circle, but that is not possible right?


Preferably I would like to keep objects A in my output file, even if they are not linked to an object B so MaskObjects and FilterObjects are not going to work I think

Hmm, could you do the following:

  • IdentifyPrimary to identify object A
  • IdentifyPrimary to identify object B, using “Per object” as the threshold strategy to find objects within the confines of object A.
  • RelateObjects to establish parents (object A) and children (object B).
  • ReassignObjectNumbers to unify objects B on a per-object A basis. You would do this by selecting “Unify” as the operation, “Per parent” as the unification method and object A as the parent objects. This will produce a single label for all “B” objects within an “A” parent, even if there is more than 1 “B” child. Also, you can make measurement with the unified objects just like any other object.
  • In ExportToSpreadsheet, you can select objects A and B to export but select “Yes” for “Combine measurements with those of the previous object.”

The thing I’m not sure about is whether the unified objects are given the same labels as object A. But you can confirm this for yourself.


Hi Mark, many thanks for your help. In the end I managed to link my objects by first relating the parent and children objects and then reassigning object numbers for the kids (to unify them to 1 object per parent). Apparently the problem was that I had expanded my children objects after relating them, thereby creating new objects that were not yet related to the parents. So I simply had to add another ‘relate objects’ step.

Nice, good to hear you figured it out!