コード例 #1
0
ファイル: cg.py プロジェクト: nikitinvv/tomoalign
    ndsets = np.int(sys.argv[2])
    nth = np.int(sys.argv[3])
    start = np.int(sys.argv[4])
    name = sys.argv[5]

    binning = 0
    data = np.zeros([nsets*ndsets*nth, (2048-512)//pow(2, binning),
                     (2448-400)//pow(2, binning)], dtype='float32')
    theta = np.zeros(nsets*ndsets*nth, dtype='float32')
    strs = ['098','099','100']
    for j in range(nsets):                
        name0 = name[:-3]+strs[j]#name[:-2]+str(np.int(name[-2:])+j)
        print(name0)
        for k in range(ndsets):
            print(j,k)
            idstart = j*ndsets*nth+k*nth
            data[idstart:idstart+nth] = np.load(name0+'ti_bin'+str(binning)+str(k)+'.npy')[:,256:-256,200:-200].astype('float32')                                   
            theta[idstart:idstart+nth] = np.load(name0+'_theta'+str(k)+'.npy').astype('float32')
    data[np.isnan(data)] = 0
    data = np.ascontiguousarray(data[start::2])
    theta = np.ascontiguousarray(theta[start::2])
    ngpus = 4
    pnz = 8
    nitercg = 32
    center = 1256-200
    res = tomoalign.cg(data, theta, pnz, center, ngpus, nitercg, padding=True)
    name+='/'+str(len(theta))
    dxchange.write_tiff_stack(res['u'], name+'/results_cg'+str(start)+'/u/r', overwrite=True)
    
    
            
コード例 #2
0
ファイル: cg_revision.py プロジェクト: nikitinvv/tomoalign
                     2448//pow(2, binning)], dtype='float32')
    theta = np.zeros(ndsets*nth, dtype='float32')
    for k in range(ndsets):
        data[k*nth:(k+1)*nth] = np.load(fname+'_bin' +
                                        str(binning)+str(k)+'.npy').astype('float32')
        theta[k*nth:(k+1)*nth] = np.load(fname+'_theta' +
                                         str(k)+'.npy').astype('float32')
    #data = data[:,512-8:512+8]                              
    data[np.isnan(data)] = 0
    data -= np.mean(data)
    
    ngpus = 4
    pnz = 4
    ptheta = 10
    niteradmm = [96, 48, 24]  # number of iterations in the ADMM scheme
    # starting window size in optical flow estimation
    startwin = [256, 128, 64]
    # step for decreasing the window size in optical flow estimtion
    stepwin = [2, 2, 2]
    center = (1202)/pow(2, binning)

    fname += '/revision_cg_nop'+'_'+str(binning)

    data = np.ascontiguousarray(data.astype('float32'))
    theta = np.ascontiguousarray(theta.astype('float32'))

    #dxchange.write_tiff_stack(
        #data, fname+'/data/d', overwrite=True)
    pprot = 100
    res = tomoalign.cg(data, theta, pprot, pnz, center, ngpus, 64)
    dxchange.write_tiff_stack(res['u'], fname+'/results/u/r', overwrite=True)
コード例 #3
0
    ndsets = np.int(sys.argv[1])
    nth = np.int(sys.argv[2])
    fname = sys.argv[3]

    binning = 1
    data = np.zeros(
        [ndsets * nth, 2048 // pow(2, binning), 2448 // pow(2, binning)],
        dtype='float32')
    theta = np.zeros(ndsets * nth, dtype='float32')
    for k in range(ndsets):
        data[k * nth:(k + 1) *
             nth] = np.load(fname + '_bin' + str(binning) + str(k) +
                            '.npy').astype('float32')
        theta[k * nth:(k + 1) * nth] = np.load(fname + '_theta' + str(k) +
                                               '.npy').astype('float32')
    data[np.isnan(data)] = 0
    # data -= np.mean(data)

    ngpus = 4
    nitercg = 32
    pnz = 8
    center = centers[fname] / pow(2, binning)

    data = np.ascontiguousarray(data)
    theta = np.ascontiguousarray(theta)
    res = tomoalign.cg(data, theta, pnz, center, ngpus, nitercg)
    dxchange.write_tiff_stack(res['u'],
                              fname + '/results_cg/u/r',
                              overwrite=True)
コード例 #4
0
    binning = 1
    data = np.zeros([ndsets * nth, 320, 544], dtype='float32')
    theta = np.zeros(ndsets * nth, dtype='float32')
    for k in range(ndsets):
        data[k * nth:(k + 1) *
             nth] = np.load(fname + '_bin' + str(binning) + str(k) +
                            '.npy').astype('float32')
        theta[k * nth:(k + 1) * nth] = np.load(fname + '_theta' + str(k) +
                                               '.npy').astype('float32')
    data[np.isnan(data)] = 0
    #data-=np.mean(data)

    ngpus = 4
    pprot = 190
    nitercg = 64
    pnz = 80
    center = 272

    res = tomoalign.cg(data,
                       theta,
                       pprot,
                       pnz,
                       center,
                       ngpus,
                       nitercg,
                       padding=False)
    dxchange.write_tiff_stack(res['u'],
                              fname + '/results_cg/u/r',
                              overwrite=True)