def METHOD_NAME(tIndex, t, labelImageSlot, hypothesesGraph, contoursDict):
    roi = [slice(None) for i in range(len(labelImageSlot.meta.shape))]
    roi[tIndex] = slice(t, t + 1)
    roi = tuple(roi)
    rawFrame = rawImageSlot[roi].wait()
    frame = labelImageSlot[roi].wait()
    frame = frame.squeeze()
    for idx in vigra.analysis.unique(frame):
        nodeId = (t, idx)
        if hypothesesGraph.hasNode(nodeId) and "lineageId" in hypothesesGraph._graph.node[nodeId]:
            # Generate frame with single label idx
            frameSingleLabel = np.zeros(frame.shape).astype(np.uint8)
            frameSingleLabel[frame == idx] = 1
            # Find contours using skimage marching squares
            contours = measure._find_contours.find_contours(frameSingleLabel, 0)
            # Doing a very stupid slow convolution to sum the head probabilities for each xy point on the contour.
            headProbs = []
            for coord in contours[0]:
                prob = 0
                for i in range(-CONV_WINDOW_SIZE, CONV_WINDOW_SIZE + 1):
                    for j in range(-CONV_WINDOW_SIZE, CONV_WINDOW_SIZE + 1):
                        if (
                            coord[0] + i >= 0
                            and coord[0] + i < rawFrame.shape[1]
                            and coord[1] + j >= 0
                            and coord[1] + j < rawFrame.shape[2]
                        ):
                            prob += rawFrame[0, coord[0] + i, coord[1] + j, 0, 2]
                headProbs.append(prob)
            headInd = np.argmax(headProbs)
            # Save contours and head index to dicts
            lineageId = hypothesesGraph._graph.node[nodeId]["lineageId"]
            if t in contoursDict:
                contoursDict[t][lineageId] = contours[0]
            else:
                contoursDict[t] = {lineageId: contours[0]}
            if t in headIndsDict:
                headIndsDict[t][lineageId] = headInd
            else:
                headIndsDict[t] = {lineageId: headInd}