Skip to content

Commit

Permalink
stackview inherits from ImageDataAggregated
Browse files Browse the repository at this point in the history
  • Loading branch information
Edgar committed Sep 29, 2024
1 parent 1e44061 commit ed3e275
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
19 changes: 19 additions & 0 deletions src/silx/gui/data/DataViews.py
Original file line number Diff line number Diff line change
Expand Up @@ -1335,8 +1335,27 @@ def createWidget(self, parent):
widget.setOptionVisible(False)
maskToolWidget = widget.getPlotWidget().getMaskToolsDockWidget().widget()
maskToolWidget.setItemMaskUpdated(True)
self.__aggregationModeAction = AggregationModeAction(parent=widget)
widget.getPlotWidget().toolBar().addAction(self.__aggregationModeAction)
self.__aggregationModeAction.sigAggregationModeChanged.connect(self._aggregationModeChanged)
return widget

def getAggregationModeAction(self) -> AggregationModeAction:
"""Action toggling the aggregation mode action
"""
return self.__aggregationModeAction

def _aggregationModeChanged(self):
plot = self.getWidget().getPlotWidget()
item = plot._getItem("image")

if item is None:
return

if isinstance(item, ImageDataAggregated):
aggregationMode = self.getAggregationModeAction().getAggregationMode()
item.setAggregationMode(aggregationMode)

def clear(self):
self.getWidget().clear()
self.__resetZoomNextTime = True
Expand Down
5 changes: 3 additions & 2 deletions src/silx/gui/plot/items/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,9 @@ class MaskImageData(ImageData):

pass

from .image_aggregated import ImageDataAggregated

class ImageStack(ImageData):
class ImageStack(ImageDataAggregated):
"""Item to store a stack of images and to show it in the plot as one
of the images of the stack.
Expand All @@ -605,7 +606,7 @@ class ImageStack(ImageData):
"""

def __init__(self):
ImageData.__init__(self)
ImageDataAggregated.__init__(self)
self.__stack = None
"""A 3D numpy array (or a mimic one, see ListOfImages)"""
self.__stackPosition = None
Expand Down

0 comments on commit ed3e275

Please sign in to comment.