Skip to content

Commit e030a9c

Browse files
committed
Fix contrast range update issue when changing image Z axis bounds
1 parent 5cd7937 commit e030a9c

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ In this release, test coverage is 79%.
4444
using the "Minimum value" or "Maximum value" buttons (which have been renamed to
4545
"Min." and "Max." in this release)
4646
* Histogram range was not updated when the "Set full range" button was clicked
47+
* Image parameters: contrast range was not updated when the image Z axis bounds were
48+
changed using the "Parameters" dialog
4749

4850
🧹 API cleanup:
4951

plotpy/panels/contrastadjustment.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ def connect_plot(self, plot: BasePlot) -> None:
102102
plot.SIG_ITEM_SELECTION_CHANGED.connect(self.selection_changed)
103103
plot.SIG_ITEM_REMOVED.connect(self.item_removed)
104104
plot.SIG_ACTIVE_ITEM_CHANGED.connect(self.active_item_changed)
105+
plot.SIG_AXIS_PARAMETERS_CHANGED.connect(
106+
lambda axis_id: self.axis_parameters_changed(plot=plot, axis_id=axis_id)
107+
)
105108

106109
def tracked_items_gen(
107110
self,
@@ -242,6 +245,16 @@ def active_item_changed(self, plot: BasePlot) -> None:
242245
self.range.set_range(_m, _M, dosignal=False)
243246
self.replot()
244247

248+
def axis_parameters_changed(self, plot: BasePlot, axis_id: int) -> None:
249+
"""Plot axis parameters changed callback
250+
251+
Args:
252+
axis_id: axis ID
253+
"""
254+
if axis_id == BasePlot.Y_RIGHT:
255+
# Colormap bounds changed, we need to update the range accordingly:
256+
self.active_item_changed(plot)
257+
245258
def set_range_style(self, multiple_ranges: bool) -> None:
246259
"""Set range style
247260

plotpy/styles/axes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ def update_item(self, item: BaseImageItem) -> None:
197197
plot.set_plot_limits(self.xmin, self.xmax, self.ymin, self.ymax)
198198
item.set_lut_range([self.zmin, self.zmax])
199199
plot.update_colormap_axis(item)
200+
for axis_id in (plot.X_BOTTOM, plot.Y_LEFT, plot.Y_RIGHT):
201+
plot.SIG_AXIS_PARAMETERS_CHANGED.emit(axis_id)
200202

201203
# TODO: remove this method in a future release
202204
def update_axes(self, obj: BaseImageItem) -> None:

0 commit comments

Comments
 (0)