def METHOD_NAME(self):
    try:
        cost_vis = self.cost_visualization_buffer.queue.get_nowait()
    except queue.Empty as empty:
        cost_vis = None
    if not cost_vis:
        cost_vis = self.cached_cost_vis
        # If we haven't received cost visualizations for a bit, clear the layer
        if time.time() > self.timeout:
            return
    else:
        # We received new cost data, so lets update our timeout
        self.timeout = (
            time.time() + CostVisualizationWidget.COST_VISUALIZATION_TIMEOUT_S
        )
        self.cached_cost_vis = cost_vis
    # Update the data and image
    self.data = np.array(cost_vis.cost).reshape(
        cost_vis.num_cols, cost_vis.num_rows
    )
    self.img.setImage(self.data)
    # Update the max number
    self.max_label.setText("max: " + str(np.max(self.data)))
    # update range if num rows was changed
    if self.prev_num_rows != cost_vis.num_rows:
        self.view_box.setRange(
            xRange=(0, cost_vis.num_cols), yRange=(0, cost_vis.num_rows)
        )
        self.prev_num_rows = cost_vis.num_rows
    for isocurve in self.curves:
        isocurve.setParentItem(self.img)
        isocurve.setData(self.data)