Example #1
0
 def menuActionNegative(self):
     # copy current state
     old = self.history[self.historyIndex]
     matrix = old['matrix'].copy()
     histogram = deepcopy(old['histogram']['plots'][0])
     # apply negative function
     matrix = Transform.negative(matrix)
     # compute histogram
     histogram = {
         'plots': [Histogram.hist(matrix)],
         'legend': ["Negative"]
     }
     # 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)