code: def getBar(imageSize, barCenter, barHalfLength, orientation='horizontal'):
    
    (nX, nY) = imageSize
    (xLoc, yLoc) = barCenter
    bar = np.zeros((nX, nY), dtype=uintType)
    if orientation == 'horizontal':
      xmin = max(0, (xLoc - barHalfLength))
      xmax = min(nX - 1, (xLoc + barHalfLength + 1))
      bar[xmin:xmax, yLoc] = 1
    elif orientation == 'vertical':
      ymin = max(0, (yLoc - barHalfLength))
      ymax = min(nY - 1, (yLoc + barHalfLength + 1))
      bar[xLoc, ymin:ymax] = 1
    else:
      raise RuntimeError("orientation has to be horizontal or vertical")
    return bar
docs: Generate a single horizontal or vertical bar
    :param imageSize
           a list of (numPixelX. numPixelY). The number of pixels on horizontal
           and vertical dimension, e.g., (20, 20)
    :param barCenter:
           (list) center of the bar, e.g. (10, 10)
    :param barHalfLength
           (int) half length of the bar. Full length is 2*barHalfLength +1
    :param orientation:
           (string) "horizontal" or "vertical"
    :return: