Merge pull request #1311 from campagnola/acq4-merge
performance fix for histogramlutitem
This commit is contained in:
commit
4562c06576
@ -165,7 +165,7 @@ class HistogramLUTItem(GraphicsWidget):
|
||||
"""
|
||||
self.imageItem = weakref.ref(img)
|
||||
img.sigImageChanged.connect(self.imageChanged)
|
||||
img.setLookupTable(self.getLookupTable) ## send function pointer, not the result
|
||||
self._setImageLookupTable()
|
||||
self.regionChanged()
|
||||
self.imageChanged(autoLevel=True)
|
||||
|
||||
@ -174,14 +174,17 @@ class HistogramLUTItem(GraphicsWidget):
|
||||
|
||||
def gradientChanged(self):
|
||||
if self.imageItem() is not None:
|
||||
if self.gradient.isLookupTrivial():
|
||||
self.imageItem().setLookupTable(None) #lambda x: x.astype(np.uint8))
|
||||
else:
|
||||
self.imageItem().setLookupTable(self.getLookupTable) ## send function pointer, not the result
|
||||
self._setImageLookupTable()
|
||||
|
||||
self.lut = None
|
||||
self.sigLookupTableChanged.emit(self)
|
||||
|
||||
def _setImageLookupTable(self):
|
||||
if self.gradient.isLookupTrivial():
|
||||
self.imageItem().setLookupTable(None) #lambda x: x.astype(np.uint8))
|
||||
else:
|
||||
self.imageItem().setLookupTable(self.getLookupTable) ## send function pointer, not the result
|
||||
|
||||
def getLookupTable(self, img=None, n=None, alpha=None):
|
||||
"""Return a lookup table from the color gradient defined by this
|
||||
HistogramLUTItem.
|
||||
@ -341,6 +344,7 @@ class HistogramLUTItem(GraphicsWidget):
|
||||
}
|
||||
|
||||
def restoreState(self, state):
|
||||
self.setLevelMode(state['mode'])
|
||||
if 'mode' in state:
|
||||
self.setLevelMode(state['mode'])
|
||||
self.gradient.restoreState(state['gradient'])
|
||||
self.setLevels(*state['levels'])
|
||||
|
Loading…
Reference in New Issue
Block a user