diff --git a/fsl/fsleyes/controls/overlaydisplaypanel.py b/fsl/fsleyes/controls/overlaydisplaypanel.py index ff4e9ac3ce0544cd8391c4831d3705f40cd92d45..a8f4842e4b535b08eb8555ac4b414a47c5c8a7c3 100644 --- a/fsl/fsleyes/controls/overlaydisplaypanel.py +++ b/fsl/fsleyes/controls/overlaydisplaypanel.py @@ -223,26 +223,8 @@ class OverlayDisplayPanel(fslpanel.FSLEyesPanel): # Add a 'load colour map' button next # to the VolumeOpts.cmap control - if isinstance(target, displayctx.VolumeOpts) and \ - p.key == 'cmap': + 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) diff --git a/fsl/fsleyes/displaycontext/volumeopts.py b/fsl/fsleyes/displaycontext/volumeopts.py index d6dc56f5036d588b0ef2efbd8bb7b2fa7da403c6..a4135b83197b04ef8f97789e9989d034203e717d 100644 --- a/fsl/fsleyes/displaycontext/volumeopts.py +++ b/fsl/fsleyes/displaycontext/volumeopts.py @@ -470,8 +470,12 @@ class VolumeOpts(ImageOpts): """ - displayRange = props.Bounds(ndims=1) - """Image values which map to the minimum and maximum colour map colours.""" + displayRange = props.Bounds(ndims=1, clamped=False) + """Image values which map to the minimum and maximum colour map colours. + The values that this property can take are unbound because of the + interaction between it and the :attr:`.Display.brightness` and + :attr:`.Display.contrast` properties. + """ clippingRange = props.Bounds(ndims=1) @@ -515,7 +519,7 @@ class VolumeOpts(ImageOpts): """ - linkLowRanges = props.Boolean(default=False) + linkLowRanges = props.Boolean(default=True) """If ``True``, the low bounds on both the :attr:`displayRange` and :attr:`clippingRange` ranges will be linked together. """ @@ -558,8 +562,8 @@ class VolumeOpts(ImageOpts): self.dataMin = 0 self.dataMax = 0 - dRangeLen = abs(self.dataMax - self.dataMin) - dMinDistance = dRangeLen / 10000.0 + # Keep range values 0.01% apart. + dMinDistance = abs(self.dataMax - self.dataMin) / 10000.0 self.clippingRange.xmin = self.dataMin - dMinDistance self.clippingRange.xmax = self.dataMax + dMinDistance @@ -571,12 +575,8 @@ class VolumeOpts(ImageOpts): self.displayRange.xlo = self.dataMin self.displayRange.xhi = self.dataMax - - # The Display.contrast property expands/contracts - # the display range, by a scaling factor up to - # approximately 10. - self.displayRange.xmin = self.dataMin - 10 * dRangeLen - self.displayRange.xmax = self.dataMax + 10 * dRangeLen + self.displayRange.xmin = self.dataMin + self.displayRange.xmax = self.dataMax self.setConstraint('displayRange', 'minDistance', dMinDistance) self.setConstraint('clippingRange', 'minDistance', dMinDistance) @@ -814,3 +814,5 @@ class VolumeOpts(ImageOpts): bindval=True, bindatt=False, unbind=not val) + + cRangePV.set(dRangePV.get())