Skip to content

Commit ecdd25e

Browse files
authored
Merge pull request #28 from David-Cai-CJ/master
Wider t0 shift allowed. Robust image autorange and histogram.
2 parents fa03459 + 5ce59d9 commit ecdd25e

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

iris/gui/control_bar.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def __init__(self, **kwargs):
254254
# Time-zero shift control
255255
# QDoubleSpinbox does not have a slot that sets the value without notifying everybody
256256
self.time_zero_shift_widget = QtWidgets.QDoubleSpinBox(parent=self)
257-
self.time_zero_shift_widget.setRange(-1000, 1000)
257+
self.time_zero_shift_widget.setRange(-2000, 2000)
258258
self.time_zero_shift_widget.setDecimals(3)
259259
self.time_zero_shift_widget.setSingleStep(0.5)
260260
self.time_zero_shift_widget.setSuffix(" ps")

iris/gui/data_viewer.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ def __init__(self, *args, **kwargs):
6666
self.layout.addWidget(self.time_series_widget)
6767
self.setLayout(self.layout)
6868

69+
self.histogram = self.image_viewer.getHistogramWidget()
70+
71+
6972
@QtCore.pyqtSlot()
7073
def update_timeseries_rect(self):
7174
rect = self.timeseries_rect_region.parentBounds().toRect()
@@ -142,10 +145,18 @@ def display(self, image, autocontrast=False):
142145
if image is None:
143146
self.image_viewer.clear()
144147
return
145-
146148
self.image_viewer.setImage(
147-
image, autoLevels=autocontrast, autoRange=autocontrast
149+
image, autoLevels=False, autoRange=False, autoHistogramRange=False
148150
)
151+
152+
if autocontrast:
153+
low = np.quantile(image, 0.01)
154+
high = np.quantile(image, 0.98)
155+
156+
self.image_viewer.setLevels(low, high)
157+
self.histogram.setHistogramRange(low*.8, high*1.2)
158+
self.histogram.setLevels(low, high)
159+
149160
self.update_timeseries_rect()
150161

151162
@QtCore.pyqtSlot(object, object)

0 commit comments

Comments
 (0)