IdentifyTertiaryObjects Overlap

IdentifyTertiaryObjects generates an object which overlaps the outline of the smaller object, and it seems to be due to this section of the IdentifyTertiaryObjects.py module:

#
# Find the outlines of the primary image and use this to shrink the
# primary image by one. This guarantees that there is something left
# of the secondary image after subtraction
#
primary_outline = outline(primary_labels)
tertiary_labels = secondary_labels.copy()
primary_mask = np.logical_or(primary_labels == 0,
                                  primary_outline)
tertiary_labels[primary_mask == False] = 0

If I change the primary_mask to = np.logical_or(primary_labels == 0, primary_labels == 0), the objects no longer overlap.

So I have to ask what the rationale is to require a guarantee that there is something left of the secondary object? It seems to me that if you label a pixel as “nuclear” it shouldn’t also be labeled “cytoplasm.”

This was an decision on our part to insure that a tertiary object will always exist corresponding to the primary and secondary objects, which is conducive to data management. The alternative is to have to deal with either (a) handling a tertiary object with no label or (b) omitting the non-existent tertiary object and handling the remaining tertiary objects with non-contiguous label numbering.

Regards,
-Mark