def getLargestAreaEcentroid(img_pred_Log):
    kernel_ones = np.ones([3, 3], np.uint8)
    closing_Log = cv2.morphologyEx(img_pred_Log, cv2.MORPH_CLOSE, kernel_ones)
    (labelsLog, numLog) = label(closing_Log, neighbors=8, background=0, return_num=True)
    regionsLog = regionprops(labelsLog)
    areasLog = [region['area'] for region in regionsLog]
    areasLogArr = np.array(areasLog)
    maxIndex = np.argmax(areasLogArr)
    value = labelsLog[(regionsLog[maxIndex]['coords'][0][0], regionsLog[maxIndex]['coords'][0][1])]
    labelsLog[(labelsLog != value)] = 0
    labelsLog[(labelsLog == value)] = 1
    centreCoords = np.round(regionsLog[maxIndex]['centroid'])
    centreCoords = centreCoords.astype(np.uint)
    radius = ((regionsLog[maxIndex]['major_axis_length'] + regionsLog[maxIndex]['minor_axis_length']) / 4)
    colsCoord = [regionsLog[maxIndex]['bbox'][1], regionsLog[maxIndex]['bbox'][3]]
    labelsArr = np.array(labelsLog)
    return (labelsArr, centreCoords, radius, colsCoord)
def getLargestAreaEcentroid(img_pred_Log):
    kernel_ones = np.ones([3, 3], np.uint8)
    closing_Log = cv2.morphologyEx(img_pred_Log, cv2.MORPH_CLOSE, kernel_ones)
    (labelsLog, numLog) = label(closing_Log, neighbors=8, background=0, return_num=True)
    regionsLog = regionprops(labelsLog)
    areasLog = [region['area'] for region in regionsLog]
    areasLogArr = np.array(areasLog)
    maxIndex = np.argmax(areasLogArr)
    value = labelsLog[(regionsLog[maxIndex]['coords'][0][0], regionsLog[maxIndex]['coords'][0][1])]
    labelsLog[(labelsLog != value)] = 0
    labelsLog[(labelsLog == value)] = 1
    centreCoords = np.round(regionsLog[maxIndex]['centroid'])
    centreCoords = centreCoords.astype(np.uint)
    radius = ((regionsLog[maxIndex]['major_axis_length'] + regionsLog[maxIndex]['minor_axis_length']) / 4)
    colsCoord = [regionsLog[maxIndex]['bbox'][1], regionsLog[maxIndex]['bbox'][3]]
    labelsArr = np.array(labelsLog)
    return (labelsArr, centreCoords, radius, colsCoord)