• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python pyqtgraph.image函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyqtgraph.image函数的典型用法代码示例。如果您正苦于以下问题:Python image函数的具体用法?Python image怎么用?Python image使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: reconstruct

      def reconstruct(self):
            self.recon.lbl.setText("Reconstruction is currently running")
            self.d= tomopy.xtomo_dataset(log='debug')
            self.reconelement=self.recon.combo.currentIndex()
            self.d.data=self.data[self.reconelement,:,:,:]
            self.d.data[self.d.data==inf]=0.01
            self.d.data[np.isnan(self.d.data)]=0.01

            
            ###TEMP
            if self.recon.reconvalue==0:
                  self.d.data = (np.exp(-0.0001*self.d.data)).astype('float32')
            else:
                  print "transmission"
            #self.d.center=128
            ###TEMP
            self.d.center=self.p1[2]
            if self.recon.method.currentIndex()==0:
                  self.d.dataset(self.d.data, theta=self.theta*np.pi/180)
                  #self.d.optimize_center()
                  self.d.mlem()
            elif self.recon.method.currentIndex()==1:
                  self.d.dataset(self.d.data, theta=self.theta)
                  #self.d.optimize_center()
                  self.d.gridrec()
            elif self.recon.method.currentIndex()==2:
                  self.d.dataset(self.d.data, theta=self.theta*np.pi/180)
                  #self.d.optimize_center()
                  self.d.art()
            print self.d.center
            pg.image(self.d.data_recon)
            self.recon.lbl.setText("Done")
            self.recon.save.setHidden(False)
开发者ID:youngpyohong,项目名称:Maps_To_Tomopy,代码行数:33,代码来源:Test_version_1.py


示例2: Image_Background

    def Image_Background(self):
        self.background=[]
        background = self.imageData[self.times<1]
        pg.image(np.mean(background[1:],axis=0), title='average background ')

        self.background = np.mean(background,axis=0)
        return
开发者ID:tropp,项目名称:signalAlign,代码行数:7,代码来源:AvgFramesBack.py


示例3: simplePlot

def simplePlot():
    data = np.random.normal(size=1000)
    pg.plot(data, title="Simplest possible plotting example")

    data = np.random.normal(size=(500,500))
    pg.image(data, title="Simplest possible image example")
    pg.QtGui.QApplication.exec_()
开发者ID:profjrr,项目名称:OETC2014_PythonInClassroom_ProfJRR,代码行数:7,代码来源:Mod2Run2.py


示例4: test_mask_data

def test_mask_data():
    # create Gaussian image:
    img_size = 500
    x = np.arange(img_size)
    y = np.arange(img_size)
    X, Y = np.meshgrid(x, y)
    center_x = img_size / 2
    center_y = img_size / 2
    width = 30000.0
    intensity = 5000.0
    img_data = intensity * \
               np.exp(-((X - center_x) ** 2 + (Y - center_y) ** 2) / width)
    mask_data = MaskData(img_data.shape)

    # test the undo and redo commands
    mask_data.mask_above_threshold(img_data, 4000)
    mask_data.mask_below_threshold(img_data, 230)
    mask_data.undo()
    mask_data.undo()
    mask_data.redo()
    mask_data.redo()
    mask_data.undo()

    mask_data.mask_rect(200, 400, 400, 100)
    mask_data.mask_QGraphicsRectItem(
        QtGui.QGraphicsRectItem(100, 10, 100, 100))
    mask_data.undo()

    mask_data.mask_polygon(
        np.array([0, 100, 150, 100, 0]), np.array([0, 0, 50, 100, 100]))
    mask_data.mask_QGraphicsPolygonItem(
        QtGui.QGraphicsEllipseItem(350, 350, 20, 20))

    # performing the plot
    pg.image(mask_data.get_img())
开发者ID:kif,项目名称:Py2DeX,代码行数:35,代码来源:MaskData.py


示例5: paramChanged

def paramChanged(param, changes):
    for param, changeType, newVal in changes:
        print("Handling name: {}, changeType: {}, newVal: {}".format(param.name, changeType, newVal))
        name=param.name()
        if changeType=='activated':
            if name=="Capture Once":
                capture()
            if name=="Least-squares Fit":
                crp.updateFit()
            if name=="Record Background":
                main.setBG()
            if name=="Reset Crop":
                main.resetCrop()
            if name=="Show BG":
                pg.image(main.bg)
        elif name=='Acquire Continuous':
            global bCaptureContinuous
            bCaptureContinuous=newVal 
        elif name=='full fit':
            crp.bDoFullFit=newVal 
        elif name=='Subtract BG':
            main.bSubtractBG=newVal 
        elif name=='Update Projections':
            main.bUpdateProjections=newVal 
        elif name=='Auto fit':
            crp.bAutoFit=newVal 
        elif name=='Averages':
            cam.Naves=newVal 
        else:
            print("Somehow missed handling '{}'".format(name))
开发者ID:morgatron,项目名称:pgBeams,代码行数:30,代码来源:main.py


示例6: Image_Background

    def Image_Background(self):
        self.background=[]
        background = self.imageData[:50]
        print 'shape of background:', np.shape(background)
        pg.image(np.mean(background[10:49],axis=0), title='average background ')

        self.background = np.mean(background,axis=0)
        return
开发者ID:tropp,项目名称:signalAlign,代码行数:8,代码来源:PaulmaptestBack.py


示例7: updateAvgStdImage

 def updateAvgStdImage(self):
     """ update the reference image types and then make sure display agrees.
     """
     self.aveImage = np.mean(self.imageData, axis=0)
     self.stdImage = np.std(self.imageData, axis=0)
     pg.image(self.aveImage, title='mean after registration')
     pg.image(self.stdImage, title='std after registration')
     return
开发者ID:tropp,项目名称:signalAlign,代码行数:8,代码来源:hunting.py


示例8: simplePlot

def simplePlot():
    data = np.random.normal(size=1000)
    pg.plot(data, title="Simplest possible plotting example")

    data = np.random.normal(size=(500,500))
    pg.image(data, title="Simplest possible image example")

    ## Start Qt event loop unless running in interactive mode or using pyside.
    if __name__ == '__main__':
        import sys
        if sys.flags.interactive != 1 or not hasattr(QtCore, 'PYQT_VERSION'):
            pg.QtGui.QApplication.exec_()
开发者ID:profjrr,项目名称:OETC2014_PythonInClassroom_ProfJRR,代码行数:12,代码来源:Mod2Run1.py


示例9: load_file

    def load_file(self, repnum):
        global options
        global basepath
        if repnum < 10:
            upf = basepath + options.upfile + "/00" + str(repnum) + "/Camera/frames.ma"
        else:
            upf = basepath + options.upfile + "/0" + str(repnum) + "/Camera/frames.ma"

        # upf = basepath + options.upfile  + '/Camera/frames.ma'
        im = []
        self.imageData = []
        print "loading data from ", upf
        try:
            im = MetaArray(file=upf, subset=(slice(0, 2), slice(64, 128), slice(64, 128)))
        except:
            print "Error loading upfile: %s\n" % upf
            return
        print "data loaded"

        self.times = im.axisValues("Time").astype("float32")
        self.imageData = im.view(np.ndarray).astype("float32")
        pg.image(self.imageData, title=str(repnum))
        # self.ProcessImage()
        print "imageData shape:", np.shape(self.imageData)
        # self.imageData = self.imageData[np.where(self.times>1)]
        back = self.imageData[np.where(np.logical_and(self.times > 2, self.times < 3))]
        print "size of back", np.shape(back)
        self.background = np.mean(back[5:], axis=0)
        # self.times= self.times-1

        # interval1=self.imageData[np.where(np.logical_and(self.times>=1, self.times<=1.25))]
        # print 'interval1 shape:', np.shape(interval1)
        # interval2=self.imageData[np.where(np.logical_and(self.times>=2, self.times<=2.25))]
        # print 'interval2 shape:', np.shape(interval2)
        # interval3=self.imageData[np.where(np.logical_and(self.times>=3, self.times<=3.25))]
        # print 'interval3 shape:', np.shape(interval3)
        # interval4=self.imageData[np.where(np.logical_and(self.times>=4, self.times<=4.25))]
        # print 'interval4 shape:', np.shape(interval4)
        # interval5=self.imageData[np.where(np.logical_and(self.times>=5, self.times<=5.25))]
        # print 'interval5 shape:', np.shape(interval5)
        # back=self.imageData[np.where(np.logical_and(self.times>0, self.times<1))]
        # background=np.mean(back,axis=0)
        # meanimg=np.mean(self.imageData, axis=0)
        # pg.image(meanimg, title='mean image')
        # self.imageData = ((interval1+interval2+interval3+interval4+interval5)/5-background)/background
        print "imageData shape:", np.shape(self.imageData)
        # pg.image(background, title='background')
        # self.imageData=scipy.ndimage.gaussian_filter(self.imageData, sigma=[1,3,3], order=0,mode='reflect',truncate=4.0)

        return
开发者ID:tropp,项目名称:signalAlign,代码行数:50,代码来源:AvgFramesFAspec.py


示例10: test_nan_image

def test_nan_image():
    img = np.ones((10,10))
    img[0,0] = np.nan
    v = pg.image(img)
    v.imageItem.getHistogram()
    app.processEvents()
    v.window().close()
开发者ID:andrewpaulreeves,项目名称:soapy,代码行数:7,代码来源:test_imageview.py


示例11: getErr

 def getErr(self, p=None, bShow=False):
     if p is None:
         p=self.getP()
     guess=self.getFramePar(p)       #figure(2)
     #guess=gauss(X, [sqrt(p[0]), p[1], p[3]])*gauss(Y, [sqrt(p[0]), p[2], p[3]])
     err = ((guess-self.targetFrame)**2).sum()
     if bShow:
         pg.image(guess, title='guess') 
         pg.image(self.targetFrame, title='frame')
     #imshow(guess)
     #draw()
     #print("Params: {0}".format(p))
     if err==0:
         err=1e-12
     err=np.log(err)
     print("err, height: {}, {}".format(err, p[0]))
     return err;
开发者ID:morgatron,项目名称:pgBeams,代码行数:17,代码来源:beamprofile.py


示例12: test_dividebyzero

def test_dividebyzero():
    import pyqtgraph as pg
    im = pg.image(pg.np.random.normal(size=(100,100)))
    im.imageItem.setAutoDownsample(True)
    im.view.setRange(xRange=[-5+25, 5e+25],yRange=[-5e+25, 5e+25])
    app.processEvents()
    QtTest.QTest.qWait(1000)
    # must manually call im.imageItem.render here or the exception
    # will only exist on the Qt event loop
    im.imageItem.render()
开发者ID:andrewpaulreeves,项目名称:soapy,代码行数:10,代码来源:test_ImageItem.py


示例13: _CompareGoodnessCorrelation

 def _CompareGoodnessCorrelation(self):
     locs = self._postProcessedLocs[:]
     distXYs = np.array([loc.distXY for loc in locs])
     
     prop = {}
     prop["lsError"] = np.array([loc.lsError for loc in locs])
     prop["photons"] = np.array([loc.photons for loc in locs]).ravel()
     prop["amp"] = np.array([loc.amp for loc in locs]).ravel()
     prop["minFitDistXY"] = np.array([loc.minFitDistXY for loc in locs]).ravel()
     prop["sigmaX"] = np.array([loc.sigmaX for loc in locs]).ravel()
     prop["sigmaY"] = np.array([loc.sigmaY for loc in locs]).ravel()
     prop["offset"] = np.array([loc.offset for loc in locs]).ravel()
     prop["distXY"] = np.array([loc.distXY for loc in locs]).ravel()
     prop["fitStdAmp"] = np.array([loc.fitStdAmp for loc in locs]).ravel()
     prop["fitStdX0"] = np.array([loc.fitStdX0 for loc in locs]).ravel()
     prop["fitStdY0"] = np.array([loc.fitStdY0 for loc in locs]).ravel()
     prop["fitStdZ0"] = np.array([loc.fitStdZ0 for loc in locs]).ravel()
     prop["fitStdOffset"] = np.array([loc.fitStdOffset for loc in locs]).ravel()
     prop["pixels"] = np.array([float(loc.nrOfPixels) for loc in locs]).ravel()
 
     rValues = []
     for k, v in prop.iteritems():
         slope, intercept, r_value, p_value, std_err = scipy.stats.linregress(distXYs, v)
         # print k, slope, intercept, "R2", r_value ** 2.0
         func = lambda d: slope * d + intercept
         rValues.append((k, slope, r_value ** 2.0))
         
         plt = pg.PlotItem()
         imv = pg.image(view = plt)
         
         plt.plot(distXYs, v, pen = None, symbol = "x", symbolSize = 2.0)
         plt.plot(distXYs, func(distXYs), pen = "r")
         plt.addLine(y = np.mean(v))
         plt.addLine(y = np.mean(v) + np.std(v))
         plt.addLine(y = np.mean(v) - np.std(v))
         
         plt.setLabels(bottom = ("distXY", "m"), left = (k))
         hist, xedges, yedges = np.histogram2d(distXYs, v, bins = 100)
         xStep, yStep = xedges[1] - xedges[0], yedges[1] - yedges[0]
         
         
         transform = QtGui.QTransform()
         transform.translate(xedges[0], yedges[0])
         transform.scale(xStep, yStep)
         imv.view.invertY(False)
         imv.view.setAspectLocked(False)    
         imv.setImage(hist, transform = transform)
         # plt.setRange(xRange = [0.0, 20e-9])
     
         
     print 
     print "Sorted R2"
     rValues.sort(key = lambda x:-x[-1])
     print "\n".join(["%s: slope %f, R2 %.3f" % (k, s, r2) for k, s, r2 in rValues])
开发者ID:david-hoffman,项目名称:SMolPhot,代码行数:54,代码来源:DebugTab.py


示例14: mkData

def mkData():
    with pg.BusyCursor():
        global data, cache, ui
        frames = ui.framesSpin.value()
        width = ui.widthSpin.value()
        height = ui.heightSpin.value()
        dtype = (ui.dtypeCombo.currentText(), ui.rgbCheck.isChecked(), frames, width, height)
        if dtype not in cache:
            if dtype[0] == 'uint8':
                dt = np.uint8
                loc = 128
                scale = 64
                mx = 255
            elif dtype[0] == 'uint16':
                dt = np.uint16
                loc = 4096
                scale = 1024
                mx = 2**16
            elif dtype[0] == 'float':
                dt = np.float
                loc = 1.0
                scale = 0.1
            
            if ui.rgbCheck.isChecked():
                data = np.random.normal(size=(frames,width,height,3), loc=loc, scale=scale)
                data = pg.gaussianFilter(data, (0, 6, 6, 0))
            else:
                data = np.random.normal(size=(frames,width,height), loc=loc, scale=scale)
                data = pg.gaussianFilter(data, (0, 6, 6))
                pg.image(data)
            if dtype[0] != 'float':
                data = np.clip(data, 0, mx)
            data = data.astype(dt)
            cache = {dtype: data} # clear to save memory (but keep one to prevent unnecessary regeneration)
            
        data = cache[dtype]
        updateLUT()
        updateSize()
开发者ID:fabioz,项目名称:pyqtgraph,代码行数:38,代码来源:VideoSpeedTest.py


示例15: badpix_from_darkcal

def badpix_from_darkcal(filename="", qtmainwin=None):


    # Use dialog_pickfile() if no filename is provided
    if filename is "":
        filename = cfel_file.dialog_pickfile(filter='*.h5', qtmainwin=qtmainwin)
        if filename is "":
            return



    # Determine what type of detector we are using
    # CsPad only for now - make fancy later (or use a selection box)
    detector = 'cspad'




    # Call routine for appropriate detector system
    if detector == 'cspad':
        mask = cfel_cspad.badpix_from_darkcal(filename)




    # Display mask (pyqtgraph.show)
    temp = mask.astype(int)
    pyqtgraph.image(temp, levels=(0,1))
    #pg.imageView.ui.menuBtn.hide()
    #pg.imageView.ui.roiBtn.hide()


    # Save mask
    outfile = cfel_file.dialog_pickfile(write=True, path='../calib/mask', filter='*.h5', qtmainwin=qtmainwin)
    if outfile is not '':
        print("Saving mask: ", outfile)
        cfel_file.write_h5(mask, outfile, field='data/data')
开发者ID:antonbarty,项目名称:cheetah,代码行数:37,代码来源:cfel_detcorr.py


示例16: dphaseReshape

 def dphaseReshape(self, data):
     altdphase = data
     for i in range(altdphase.shape[0]):
         for j in range(altdphase.shape[1]):
             #for k in range(dphase.shape[2]):
             if altdphase[i,j]<-4*np.pi/5 or altdphase[i,j]>4*np.pi/5:
                 altdphase[i,j] = 10
             elif altdphase[i,j]<-2*np.pi/5:
                 altdphase[i,j] = 20
             elif altdphase[i,j]<0:
                 altdphase[i,j] = 30
             elif altdphase[i,j]<2*np.pi/5:
                 altdphase[i,j] = 40
             else:
                 altdphase[i,j] = 50
     
     self.redphase = pg.image(altdphase, title="transformed 2X Phi map", levels=(10, 50))
     return
开发者ID:tropp,项目名称:signalAlign,代码行数:18,代码来源:PaulmaptestBack.py


示例17: in_vs_out_widget

def in_vs_out_widget(A, B, f = None, title = ''):
    if (A is None) and (B is None) :
        return None
    import pyqtgraph as pg
    A_in_out_plots = pg.image(title = title)

    print title
    A_in_out = hstack_if_not_None(A, B)

    if f is not None :
        A_in_out = f(A_in_out)
    
    if len(A_in_out.shape) == 2 :
        A_in_out_plots.setImage(A_in_out.T)
    elif len(A_in_out.shape) == 3 :
        A_in_out_plots.setImage(A_in_out)
    
    return A_in_out_plots
开发者ID:andyofmelbourne,项目名称:Ptychography,代码行数:18,代码来源:display.py


示例18: func

    import pyqtgraph as pg


    def func():
        time.sleep(2)
        img[100:1000,100:1000] = 0
        #shit.setImage(qim.ndarray)
        shit.updateImage()
        QtGui.qApp.processEvents() # update
        print("image changed, try minimizing and then maximazing")

    t = threading.Thread(target=func)
    win_main = QtGui.QMainWindow()
    img = loadcv(path)
    qim = np2qi(img)
    uimain = thiswin(qim)
    uimain.show()
    axes = None
    if img.ndim == 3:
        if img.shape[2] <= 4:
            axes = {'t': None, 'x': 2, 'y': 1, 'c': 0}
        else:
            axes = {'t': 2, 'x': 1, 'y': 0, 'c': None}
    if axes:
        print("sending with axes")
        shit = pg.image(img)
    else:
        shit = pg.image(img)
    t.start()
    sys.exit(app.exec_())
开发者ID:davtoh,项目名称:RRtools,代码行数:30,代码来源:QNImage.py


示例19: int

#prepare dtm
clip=[-124.17, -122.65, 37.80, 39.30]
xmin = int((clip[0] - gt[0]) / gt[1])
ymin =int((clip[3] - gt[3]) / gt[5])
xmax = int((clip[1] - gt[0]) / gt[1])
ymax =int((clip[2] - gt[3]) / gt[5])	
win_xsize=xmax-xmin
win_ysize=ymax-ymin
x_buff=150 #new resolution
y_buff=150 #new resolution
data = np.transpose(layer.GetRasterBand(1).ReadAsArray(xmin,ymin,
						win_xsize,win_ysize,
						x_buff,y_buff))

# Disconnect old ROI
imv = pg.image(data)
# Create new ROI and install exactly as done in ImageView.__init__
# imv.roi.sigRegionChanged.disconnect(imv.roiChanged)
imv.roi = pg.LineROI((80, 80), (100, 100), 1)

# imv.roi.setZValue(20)
imv.view.addItem(imv.roi)
imv.roi.hide()
imv.roi.sigRegionChanged.connect(imv.roiChanged)






## Start Qt event loop unless running in interactive mode.
开发者ID:rvalenzuelar,项目名称:pythonx,代码行数:31,代码来源:change_roi.py


示例20: pos2Grid

    xd = xd[w]
    yd = yd[w]
    data = data[w]
	
    xi,yi = np.array(np.meshgrid(xbins,ybins,indexing='ij'))
    zi = xi*0
    zi[xd,yd] = data
    return zi

prefix = "data/ISCCP.DX.0.GOE-7.1991.01.01."
times = np.arange(0,22,3)*100

xbins = np.arange(501)
ybins = np.arange(501)
zi = np.zeros((len(times),501,501))

for i in np.arange(len(times)):
    print "Time # {}".format(times[i])
    filename = "{:s}{:04d}.AES".format(prefix,times[i])
    stdat = pydx.dxread(filename)
    irads = np.array([o.irad for o in stdat.dxs1s])
    zi[i,:,:] = pos2Grid(stdat.x,stdat.y,irads,xbins=xbins,ybins=ybins)

zi = zi[:,:,::-1]
#3d image plots as time series, use scroll bar to cycle through images
pg.image(zi)

#1 day average of cloud cover
zavg = np.average(zi,axis=0)
pg.image(zavg)
开发者ID:ordirules,项目名称:dxread,代码行数:30,代码来源:iradaverage.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pyqtgraph.intColor函数代码示例发布时间:2022-05-27
下一篇:
Python pyqtcore.QVector类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap