def recalc_orig(dic, data, fn, axis=-1):
    """
    Recalculate the origin for given axis
    """
    s = float(data.shape[axis])
    if dic[fn + 'QUADFLAG'] == 0 and axis != -1:
        s = int(s / 2.0)
    if dic['FD2DPHASE'] == 1 and fn != 'FDF2' and dic[fn + 'FTFLAG'] != 1:
        s = int(s / 2.0)
    sw = dic[fn + 'SW']
    car = dic[fn + 'CAR']
    obs = dic[fn + 'OBS']
    s2 = float(dic[fn + 'CENTER'])
    dic[fn + 'ORIG'] = car * obs - sw * ((s - s2) / s)
    return dic
