The RelateObjects module does not replace the original labels with the new ones, which results in unexpected behavior if a later FilterObjects module is run with the parent and child objects (namely, that the wrong child objects are being filtered).
Assuming there is no need to keep the non-related child objects, the code at the end of the module’s run subroutine should be replaced as follows:
parent_labeled_children = np.zeros(children.segmented.shape, int)
parent_labeled_children[children.segmented > 0] =
parents_of[children.segmented[children.segmented > 0]-1]
if workspace.frame is not None: figure = workspace.create_or_find_figure(title="RelateObjects, image cycle #%d"%( workspace.measurements.image_set_number),subplots=(2,2)) figure.subplot_imshow_labels(0,0,parents.segmented, title = self.parent_name.value) figure.subplot_imshow_labels(1,0,children.segmented, title = self.sub_object_name.value, sharex = figure.subplot(0,0), sharey = figure.subplot(0,0)) figure.subplot_imshow_labels(0,1,children.segmented, "%s labeled by %s"% (self.sub_object_name.value, self.parent_name.value), sharex = figure.subplot(0,0), sharey = figure.subplot(0,0)) children.segmented = parent_labeled_children[/code]