当前位置: 首页>>代码示例>>Python>>正文


Python Transform.paddingZero方法代码示例

本文整理汇总了Python中Transform.paddingZero方法的典型用法代码示例。如果您正苦于以下问题:Python Transform.paddingZero方法的具体用法?Python Transform.paddingZero怎么用?Python Transform.paddingZero使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Transform的用法示例。


在下文中一共展示了Transform.paddingZero方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: child

# 需要导入模块: import Transform [as 别名]
# 或者: from Transform import paddingZero [as 别名]
def child(i, step, totalimage, prefs, kind, finalData, monitor, nOutstart):

    Start = i*step;
    End = (i+1)*step;
    if(Start >= totalimage):
        return 0
    if(End > totalimage):
        End = totalimage;

    for iproj in range(Start,End):
        nOut = nOutstart+iproj
        # outfilename = "%s/%s_%s.hdf" % (prefs['out']['filePath'], prefs['projection']['Prefix'], Transform.paddingZero(nOut, int(prefs['out']['numberDigit'])))
        dataArray = []

        for i in prefs['series']:
            i = i -1
            filename = "%s/%s%s.%s" % ( prefs['filePath'], prefs[kind]['Prefix'][0], Transform.paddingZero(int(prefs[kind]['Num'][i][iproj]), prefs['numberDigit'] ), prefs[kind]['extension'] )
            im = Image.open(filename)
            imarray = np.array(im)
            dataArray.append(0)
            dataArray[i] = imarray[(prefs['ROIy'][i][0]-1):prefs['ROIy'][i][-1] , (prefs['ROIx'][i][0]-1):prefs['ROIx'][i][-1]] # corp the array
            # if prefs['slits']['shouldCorr']: #comment out for this momoent, if need corr, need to initialize in the initialize script
            # dataAve[iavg] = slitposcorr(dataAve[iavg], prefs, j, kind, iavg)
            dataArray[i], _, _, aveint = Transform.preprocess(dataArray[i], prefs, i)
            if prefs['vis']['intMonitor']:
                monitor[iproj][i]=array('d', [aveint, prefs[kind]['Num'][i][iproj], nOut])

        dataResutArray, sminx, smaxx = Transform.stitching(dataArray, prefs)
        finalData[iproj] = dataResutArray

    return 1
开发者ID:kyueaes,项目名称:tomoPre,代码行数:33,代码来源:projTransform.py

示例2: child

# 需要导入模块: import Transform [as 别名]
# 或者: from Transform import paddingZero [as 别名]
def child(i, procs, step, totalimage, prefs, kind, j, dataAve, monitor, nOut):

    Start = i*step;
    End = (i+1)*step;
    if(Start >= totalimage):
        return 0
    if(End > totalimage):
        End = totalimage;

    for iavg in range(Start, End ):
        filename = "%s/%s%s.%s" % ( prefs['filePath'], prefs[kind]['Prefix'][0], Transform.paddingZero(int(prefs[kind]['Num'][j][iavg]), prefs['numberDigit'] ), prefs[kind]['extension'] )
        im = Image.open(filename)
        imarray = np.array(im)
        dataAve[iavg] = imarray[(prefs['ROIy'][j][0]-1):prefs['ROIy'][j][-1] , (prefs['ROIx'][j][0]-1):prefs['ROIx'][j][-1]] # corp the array
        # if prefs['slits']['shouldCorr']: #comment out for this momoent, if need corr, need to initialize in the initialize script
        # dataAve[iavg] = slitposcorr(dataAve[iavg], prefs, j, kind, iavg)
        # print iavg
        if prefs['vis']['intMonitor']:
            _, _, _, aveint = Transform.preprocess(dataAve[iavg], prefs, j)
            monitor[iavg][j] = array('d', [aveint, prefs[kind]['Num'][j][iavg], nOut])

    return 1
开发者ID:kyueaes,项目名称:tomoPre,代码行数:24,代码来源:avgTransform.py

示例3: projTransform

# 需要导入模块: import Transform [as 别名]
# 或者: from Transform import paddingZero [as 别名]
def projTransform(prefs, nOutstart, sType, kind, fileID, moncnt):

    prefs = Transform.stitching_calcbefore(prefs)

    maxx = 0; minx = sys.maxint
    sArrayX = 0; sArrayY = 0

    iproj = 0
    dataArray = []
    for i in prefs['series']:
        i = i -1
        filename = "%s/%s%s.%s" % ( prefs['filePath'], prefs[kind]['Prefix'][0], Transform.paddingZero(int(prefs[kind]['Num'][i][iproj]), prefs['numberDigit'] ), prefs[kind]['extension'] )
        # filename = "b_image.tif" # this tif image is for testing purpose
        im = Image.open(filename)
        imarray = np.array(im)
        dataArray.append(0)
        dataArray[i] = imarray[(prefs['ROIy'][i][0]-1):prefs['ROIy'][i][-1] , (prefs['ROIx'][i][0]-1):prefs['ROIx'][i][-1]] # corp the array
        # if prefs['slits']['shouldCorr']: #comment out for this momoent, if need corr, need to initialize in the initialize script
        # dataAve[iavg] = slitposcorr(dataAve[iavg], prefs, j, kind, iavg)
        dataArray[i], _, _, aveint = Transform.preprocess(dataArray[i], prefs, i)
    dataResutArray, sminx, smaxx = Transform.stitching(dataArray, prefs)


    totalimage = len(prefs[kind]['Num'][0])
    # totalimage = 2
    step = 100
    workjob = []
    procs = totalimage/step + 1


    # finalData = np.zeros(shape=( len(prefs[kind]['Num'][0]), dataResutArray.shape[0], dataResutArray.shape[1] ))

    sharedArray = Array(ctypes.c_double, len(prefs[kind]['Num'][0])*dataResutArray.shape[0]*dataResutArray.shape[1], lock=False)
    sharedNpArray = np.frombuffer(sharedArray, dtype=ctypes.c_double)
    finalData = sharedNpArray.reshape(len(prefs[kind]['Num'][0]), dataResutArray.shape[0], dataResutArray.shape[1])

    sharedMonitor = Array(ctypes.c_double, totalimage*len(prefs['series'])*3, lock=False)
    sharedNpMonitor = np.frombuffer(sharedMonitor, dtype=ctypes.c_double)
    monitor = sharedNpMonitor.reshape(totalimage, len(prefs['series']), 3)

    for i in range(0, procs):
        process = Process(target=child, args = (i, step, totalimage, prefs, kind, finalData, monitor, nOutstart))
        workjob.append(process)

    for j in workjob:
        j.start()

    for j in workjob:
        j.join()

    # for iproj in range(0,len(prefs[kind]['Num'][0])):
    #     nOut = nOutstart+iproj
    #     # outfilename = "%s/%s_%s.hdf" % (prefs['out']['filePath'], prefs['projection']['Prefix'], Transform.paddingZero(nOut, int(prefs['out']['numberDigit'])))
    #     dataArray = []
    #
    #     for i in prefs['series']:
    #         i = i -1
    #         filename = "%s/%s%s.%s" % ( prefs['filePath'], prefs[kind]['Prefix'][0], Transform.paddingZero(int(prefs[kind]['Num'][i][iproj]), prefs['numberDigit'] ), prefs[kind]['extension'] )
    #         # filename = "b_image.tif" # this tif image is for testing purpose
    #         im = Image.open(filename)
    #         imarray = np.array(im)
    #         dataArray.append(0)
    #         dataArray[i] = imarray[(prefs['ROIy'][i][0]-1):prefs['ROIy'][i][-1] , (prefs['ROIx'][i][0]-1):prefs['ROIx'][i][-1]] # corp the array
    #         # if prefs['slits']['shouldCorr']: #comment out for this momoent, if need corr, need to initialize in the initialize script
    #         # dataAve[iavg] = slitposcorr(dataAve[iavg], prefs, j, kind, iavg)
    #         dataArray[i], _, _, aveint = Transform.preprocess(dataArray[i], prefs, i)
    #         if prefs['vis']['intMonitor']:
    #             monitor.append(array('d', [aveint, prefs[kind]['Num'][i][iproj], nOut]))
    #
    #     dataResutArray, sminx, smaxx = Transform.stitching(dataArray, prefs)
    #
    #     if iproj == 0:
    #         finalData = np.zeros(shape=( len(prefs[kind]['Num'][0]), dataResutArray.shape[0], dataResutArray.shape[1] ))
    #
    #     finalData[iproj] = dataResutArray




        # d = array('i', finalData)
    # minx = min(minx, sminx)
    # maxx = max(maxx, smaxx)
    #
    # sArrayX = max(sArrayX, dataResutArray.shape[1])
    # sArrayY = max(sArrayY, dataResutArray.shape[0])

        # write the data array to the file


    prefs = Transform.stitching_calcafter(prefs, minx, maxx, sArrayX, sArrayY)

    moncnt = moncnt + len(prefs[kind]['Num'][0])
    nOutarg = nOutstart+len(prefs[kind]['Num'][0])

    return prefs, nOutarg, monitor, moncnt, finalData


# prefs = dict()
# prefs = Stitching_InitConv_TIFFtoHDF4_single.initPyPref(prefs)
# fileID = '/local/kyue/test/txt'
#.........这里部分代码省略.........
开发者ID:kyueaes,项目名称:tomoPre,代码行数:103,代码来源:projTransform.py


注:本文中的Transform.paddingZero方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。