# Buggy code
def display(self, workspace, figure):
    if not self.show_window:
        return

    figure.set_subplots((2, 2))

    renumbered_parent_labels = cellprofiler.gui.tools.renumber_labels_for_display(
        workspace.display_data.parent_labels
    )

    child_labels = workspace.display_data.child_labels

    parents_of = workspace.display_data.parents_of

    #
    # discover the mapping so that we can apply it to the children
    #
    mapping = numpy.arange(workspace.display_data.parent_count + 1)

    mapping[workspace.display_data.parent_labels.flatten()] = (
        renumbered_parent_labels.flatten()
    )

    parent_labeled_children = numpy.zeros(child_labels.shape, int)

    mask = child_labels > 0

    parent_labeled_children[mask] = mapping[parents_of[child_labels[mask] - 1]]

    figure.subplot_imshow_labels(
        0, 0, renumbered_parent_labels, title=self.parent_name.value, renumber=False
    )

    figure.subplot_imshow_labels(
        1,
        0,
        child_labels,
        title=self.sub_object_name.value,
        sharex=figure.subplot(0, 0),
        sharey=figure.subplot(0, 0),
    )

    figure.subplot_imshow_labels(
        0,
        1,
        parent_labeled_children,
        "{} labeled by {}".format(self.sub_object_name.value, self.parent_name.value),
        renumber=False,
        sharex=figure.subplot(0, 0),
        sharey=figure.subplot(0, 0),
    )


# Traceback (ValueError)
Traceback (most recent call last):
File "C:\Users\brayma2\Desktop\GitHub\CellProfiler\cellprofiler\gui\pipelinecontroller.py", line 2844, in do_step
self.__pipeline.run_module(module, workspace)
File "C:\Users\brayma2\Desktop\GitHub\CellProfiler\cellprofiler\pipeline.py", line 2108, in run_module
module.run(workspace)
File "C:\Users\brayma2\Desktop\GitHub\CellProfiler\cellprofiler\modules\relateobjects.py", line 252, in run
self.calculate_centroid_distances(workspace, parent_name)
File "C:\Users\brayma2\Desktop\GitHub\CellProfiler\cellprofiler\modules\relateobjects.py", line 336, in calculate_centroid_distances
parents_of = self.get_parents_of(workspace, parent_name)
File "C:\Users\brayma2\Desktop\GitHub\CellProfiler\cellprofiler\modules\relateobjects.py", line 475, in get_parents_of
reverse_lookup_len = max(np.max(primary_parents_of) + 1,
File "C:\Python27\lib\site-packages\numpy\core\fromnumeric.py", line 2263, in amax
out=out, keepdims=keepdims)
File "C:\Python27\lib\site-packages\numpy\core\_methods.py", line 26, in _amax
return umr_maximum(a, axis, None, out, keepdims)
ValueError: zero-size array to reduction operation maximum which has no identity

# Fixed code
def display(self, workspace, figure):
    if not self.show_window:
        return

    dimensions = workspace.display_data.dimensions

    figure.set_subplots((2, 2), dimensions=dimensions)

    child_labels = workspace.display_data.child_labels

    parents_of = workspace.display_data.parents_of

    parent_labels = workspace.display_data.parent_labels

    #
    # discover the mapping so that we can apply it to the children
    #
    mapping = numpy.arange(workspace.display_data.parent_count + 1)

    mapping[parent_labels] = parent_labels

    parent_labeled_children = numpy.zeros(child_labels.shape, int)

    mask = child_labels > 0

    parent_labeled_children[mask] = mapping[parents_of[child_labels[mask] - 1]]

    figure.subplot_imshow_labels(
        0, 0, parent_labels, title=self.x_name.value, dimensions=dimensions
    )

    figure.subplot_imshow_labels(
        1, 0, child_labels, title=self.y_name.value, dimensions=dimensions
    )

    figure.subplot_imshow_labels(
        0,
        1,
        parent_labeled_children,
        "{} labeled by {}".format(self.y_name.value, self.x_name.value),
        dimensions=dimensions,
    )