def create_mask2d(center, shape, size, nx, ny, even=0, spacing=None):
    # extract offset d = 2r+1 --> r=ceil((d-1)/2.0)
    # s=11 -> r=5
    # s=10 -> r=5
    offset = param.offset.split(',')
    offset[0] = int(offset[0])
    offset[1] = int(offset[1])

    # initialize 2d grid
    xx, yy = numpy.mgrid[:nx, :ny]
    mask2d = numpy.zeros((nx, ny))
    xc = center[0]
    yc = center[1]
    if 'mm' in size:
        from numpy import ceil
        size = int(size[:-2])
        mean_spacing_xy = (spacing[1] + spacing[2]) / 2.0
        length = round(float(size) / mean_spacing_xy)
        radius = ceil((int(length) - 1) / 2.0)
    else:
        from numpy import ceil
        radius = ceil((int(size) - 1) / 2.0)

    if shape == 'box':
        mask2d[xc - radius:xc + radius + 1, yc - radius:yc + radius + 1] = 1

    elif shape == 'cylinder':
        mask2d = ((xx+offset[0]-xc)**2 + (yy+offset[1]-yc)**2 <= radius**2)*1

    elif shape == 'gaussian':
        sigma = float(radius)
        mask2d = numpy.exp(-(((xx+xc-offset[0])**2)/(2*(sigma**2)) + ((yy+offset[1]-yc)**2)/(2*(sigma**2))))

    # import matplotlib.pyplot as plt
    # plt.imshow(mask2d)
    # plt.show()

    return mask2d
dataset/ETHPy150Open neuropoly/spinalcordtoolbox/scripts/sct_create_mask.py/create_mask2d/swapped operands of `-`