diff --git a/src/silx/gui/data/DataViews.py b/src/silx/gui/data/DataViews.py index f9e810343f..36ad358e14 100644 --- a/src/silx/gui/data/DataViews.py +++ b/src/silx/gui/data/DataViews.py @@ -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 diff --git a/src/silx/gui/plot/items/image.py b/src/silx/gui/plot/items/image.py index 4046b65630..c462b711a1 100644 --- a/src/silx/gui/plot/items/image.py +++ b/src/silx/gui/plot/items/image.py @@ -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. @@ -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