Example #1
0
 def menuActionLog(self):
     # get parameters
     popup = DialogLog(self.window)
     popup.exec_()
     if popup.c is None:
         return
     # copy current state
     old = self.history[self.historyIndex]
     matrix = old['matrix'].copy()
     histogram = deepcopy(old['histogram']['plots'][0])
     # apply log function
     matrix = Transform.log(matrix, popup.c)
     # compute histogram
     histogram = {
         'plots': [Histogram.hist(matrix)],
         'legend': [str(popup.c) + "*log(i+1)"]
     }
     # add new state
     self.appendHistory({
         'matrix': matrix,
         'histogram': histogram,
         'saved': False
     })
     self.updateImage(matrix)
     hist = [old['histogram']['plots'][0]] + histogram['plots']
     legend = ["Old"] + histogram['legend']
     self.windowHist.setHistogram(hist, legend)