Beispiel #1
0
def apply_shifts(data, ops, ymax, xmax, ymax1, xmax1):
    if ops['bidiphase'] != 0:
        shift_bidiphase(data, ops['bidiphase'])
    shift_data(data, ymax, xmax, ops['refImg'].mean())
    if ops['nonrigid'] == True:
        data = nonrigid.transform_data(data, ops, ymax1, xmax1)
    return data
Beispiel #2
0
def register_and_shift(data, refAndMasks, ops):
    ''' register data matrix to reference image and shift '''
    ''' need reference image ops['refImg']'''
    ''' run refAndMasks = prepare_refAndMasks(ops) to get fft'ed masks '''
    ''' calls phasecorr '''
    if ops['bidiphase'] != 0:
        shift_bidiphase(data, ops['bidiphase'])
    nr = False
    yxnr = []
    if ops['nonrigid'] and len(refAndMasks) > 3:
        nb = ops['nblocks'][0] * ops['nblocks'][1]
        nr = True

    # rigid registration
    ymax, xmax, cmax = phasecorr(data, refAndMasks[:3], ops)
    shift_data(data, ymax, xmax, ops['refImg'].mean())
    Y = []
    # non-rigid registration
    if nr:
        ymax1, xmax1, cmax1, _ = nonrigid.phasecorr(data, refAndMasks[3:], ops)
        yxnr = [ymax1, xmax1, cmax1]
        data = nonrigid.transform_data(data, ops, ymax1, xmax1)
    return data, ymax, xmax, cmax, yxnr