diff --git a/fsl/fsleyes/controls/overlaydisplaypanel.py b/fsl/fsleyes/controls/overlaydisplaypanel.py index aa01a05c8cc33c2b3824c089e2a0ec1d205123ad..ff4e9ac3ce0544cd8391c4831d3705f40cd92d45 100644 --- a/fsl/fsleyes/controls/overlaydisplaypanel.py +++ b/fsl/fsleyes/controls/overlaydisplaypanel.py @@ -226,6 +226,23 @@ class OverlayDisplayPanel(fslpanel.FSLEyesPanel): if isinstance(target, displayctx.VolumeOpts) and \ p.key == 'cmap': widget = self.__buildColourMapWidget(widget) + + if isinstance(target, displayctx.VolumeOpts) and \ + p.key == 'displayRange': + + # This is a big hack. The VolumeOpts displayRange + # has limits which are much bigger than the data + # range, due to the relationship between display + # range and brightness/contrast. But we want the + # display range sliders to have the data range as + # their limits. You should think of a nicer way + # to do this. + log.debug('Forcing displayRange slider range to data ' + 'range: [{:0.3f}, {:0.3f}]'.format( + target.dataMin, target.dataMax)) + + widget.GetChildren()[0].SetLimits(target.dataMin, + target.dataMax) widgets.append(widget)