示例#1
0
    def recalcHist(self, i, postponeToIdle):
        if postponeToIdle:
            self.recalcHist_todo_Set.add(i)
            return
        img = self.data[ tuple(self.zsec) ][i]
        from . import useful as U
        mmms = U.mmms( img )
        self.mmms[i] = mmms
        #time import time
        #time x = time.clock()
        # print mmms

        from . import useful as U
        if self.hist_arr[i] is not None:
            #glSeb  import time
            #glSeb  x = time.clock()
            #         print U.mmms(self.hist_arr[i]),
            U.histogram(img, amin=self.hist_min[i], amax=self.hist_max[i], histArr=self.hist_arr[i])
            #         print U.mmms(self.hist_arr[i])
            self.hist[i].setHist(self.hist_arr[i], self.hist_min[i], self.hist_max[i])
            #glSeb  print "ms: %.2f"% ((time.clock()-x)*1000.0)
            ## FIXME  setHist needs to NOT alloc xArray every time !!!
        else:
            resolution = 10000
    
            a_h = U.histogram(img, resolution, mmms[0], mmms[1])

            self.hist[i].setHist(a_h, mmms[0], mmms[1])
示例#2
0
    def recalcHist(self, i, postponeToIdle):
        if postponeToIdle:
            self.recalcHist_todo_Set.add(i)
            return
        img = self.data[tuple(self.zsec)][i]
        from . import useful as U
        mmms = U.mmms(img)
        self.mmms[i] = mmms
        #time import time
        #time x = time.clock()
        # print mmms

        from . import useful as U
        if self.hist_arr[i] is not None:
            #glSeb  import time
            #glSeb  x = time.clock()
            #         print U.mmms(self.hist_arr[i]),
            U.histogram(img,
                        amin=self.hist_min[i],
                        amax=self.hist_max[i],
                        histArr=self.hist_arr[i])
            #         print U.mmms(self.hist_arr[i])
            self.hist[i].setHist(self.hist_arr[i], self.hist_min[i],
                                 self.hist_max[i])
            #glSeb  print "ms: %.2f"% ((time.clock()-x)*1000.0)
            ## FIXME  setHist needs to NOT alloc xArray every time !!!
        else:
            resolution = 10000

            a_h = U.histogram(img, resolution, mmms[0], mmms[1])

            self.hist[i].setHist(a_h, mmms[0], mmms[1])
示例#3
0
    def recalcHist(self, triggeredFromIdle):
        if not triggeredFromIdle:
            self.recalcHist_todo_Set.add(0)
            return

        #CHECK img = self.viewer.m_imgArr
        img = self.img
        from . import useful as U
        mmms = U.mmms( img )
        self.mmms = mmms
            #time import time
            #time x = time.clock()
            # print mmms

        if self.hist_arr is not None:
            #glSeb  import time
            #glSeb  x = time.clock()
            if sys.platform.startswith('linux'): # 20180712 win SIM error
                wx.Yield() # 20180406 dileptus linux
            U.histogram(img, amin=self.hist_min, amax=self.hist_max, histArr=self.hist_arr)
            self.hist.setHist(self.hist_arr, self.hist_min, self.hist_max)
            #glSeb  print "ms: %.2f"% ((time.clock()-x)*1000.0)
            ## FIXME  setHist needs to NOT alloc xArray every time !!!
        else:
        
            #          self.viewer.m_imgChanged = True
            #          self.viewer.Refresh(False)
    
            #20040915(OverflowError: float too large to convert)            resolution = int(mmms[1]-mmms[0]+2)
            #20040915if resolution > 10000:
            #20040915   resolution = 10000
            #20040915elif resolution < 1000: #CHECK
            #20040915   resolution = 10000 # CHECK
            resolution = 10000
    
            a_h = U.histogram(img, resolution, mmms[0], mmms[1])

            #    self.hist.setHist(a_h, mmms[0], mmms[1])
            self.recalcHist__a_h = a_h
            self.recalcHist__Done = 1
            #time print "recalcHist ms: %.2f"% ((time.clock()-x)*1000.0)
            #20171225 py2to3
            if wx.VERSION[0] <= 3:
                mainthread = wx.Thread_IsMain()
            elif wx.VERSION[0] >= 4:
                mainthread = wx.IsMainThread()
            if mainthread:#wx.IsMainThread():#Thread_IsMain():
                self.hist.setHist(self.recalcHist__a_h,
                                  self.mmms[0],
                                  self.mmms[1])
            else:
                wx.PostEvent(self.frame, self.__class__.ResultEvent(None))
示例#4
0
    def recalcHist(self, triggeredFromIdle):
        if not triggeredFromIdle:
            self.recalcHist_todo_Set.add(0)
            return

        #CHECK img = self.viewer.m_imgArr
        img = self.img
        from . import useful as U
        mmms = U.mmms(img)
        self.mmms = mmms
        #time import time
        #time x = time.clock()
        # print mmms

        if self.hist_arr is not None:
            #glSeb  import time
            #glSeb  x = time.clock()
            wx.Yield()  # 20180406 dileptus
            U.histogram(img,
                        amin=self.hist_min,
                        amax=self.hist_max,
                        histArr=self.hist_arr)
            self.hist.setHist(self.hist_arr, self.hist_min, self.hist_max)
            #glSeb  print "ms: %.2f"% ((time.clock()-x)*1000.0)
            ## FIXME  setHist needs to NOT alloc xArray every time !!!
        else:

            #          self.viewer.m_imgChanged = True
            #          self.viewer.Refresh(False)

            #20040915(OverflowError: float too large to convert)            resolution = int(mmms[1]-mmms[0]+2)
            #20040915if resolution > 10000:
            #20040915   resolution = 10000
            #20040915elif resolution < 1000: #CHECK
            #20040915   resolution = 10000 # CHECK
            resolution = 10000

            a_h = U.histogram(img, resolution, mmms[0], mmms[1])

            #    self.hist.setHist(a_h, mmms[0], mmms[1])
            self.recalcHist__a_h = a_h
            self.recalcHist__Done = 1
            #time print "recalcHist ms: %.2f"% ((time.clock()-x)*1000.0)
            #20171225 py2to3
            if wx.IsMainThread():  #Thread_IsMain():
                self.hist.setHist(self.recalcHist__a_h, self.mmms[0],
                                  self.mmms[1])
            else:
                wx.PostEvent(self.frame, self.__class__.ResultEvent(None))