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


Python pyqtgraph.image函数代码示例

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


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


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