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.”