From 42b62d5b219aa9680d0c1504b06de80535970f1c Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauld.mccarthy@gmail.com>
Date: Mon, 23 Jun 2014 09:57:18 +0100
Subject: [PATCH] BoundsValueList setRange now sets lo/hi list values together,
 so the individual values don't get validated.

---
 fsl/data/fslimage.py          | 5 ++---
 fsl/props/properties_types.py | 5 ++---
 fsl/props/properties_value.py | 5 -----
 3 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/fsl/data/fslimage.py b/fsl/data/fslimage.py
index 394fbc30c..a8cd635a6 100644
--- a/fsl/data/fslimage.py
+++ b/fsl/data/fslimage.py
@@ -412,11 +412,10 @@ class ImageDisplay(props.HasProperties):
             self.dataMax = image.data.max()
 
         dRangeLen = abs(self.dataMax - self.dataMin)
-        
-        self.displayRange.setLo( 0, self.dataMin)
-        self.displayRange.setHi( 0, self.dataMax)
+
         self.displayRange.setMin(0, self.dataMin - 0.5 * dRangeLen)
         self.displayRange.setMax(0, self.dataMax + 0.5 * dRangeLen)
+        self.displayRange.setRange(0, self.dataMin, self.dataMax)
 
         # is this a 4D volume?
         if self.is4DImage():
diff --git a/fsl/props/properties_types.py b/fsl/props/properties_types.py
index 8bd2721ac..e41d0c55f 100644
--- a/fsl/props/properties_types.py
+++ b/fsl/props/properties_types.py
@@ -428,9 +428,8 @@ class BoundsValueList(propvals.PropertyValueList):
     def setHi(self, axis, value):
         self[axis * 2 + 1] = value
 
-    def setRange(self, axis, values):
-        self.setMin(axis, values[0])
-        self.setMax(axis, values[1])
+    def setRange(self, axis, minval, maxval):
+        self[axis * 2:axis * 2 + 2] = [minval, maxval]
 
     def getMin(self, axis):
         return self.getPropertyValueList()[axis * 2].getAttribute('minval')
diff --git a/fsl/props/properties_value.py b/fsl/props/properties_value.py
index eb0a5c324..464988b37 100644
--- a/fsl/props/properties_value.py
+++ b/fsl/props/properties_value.py
@@ -453,11 +453,6 @@ class PropertyValueList(PropertyValue):
         given item in a PropertyValue object.
         """
 
-        # The only interesting thing here is the postNotifyFunc -
-        # whenever a PropertyValue in this list changes, the entire
-        # list is revalidated. This is primarily to ensure that
-        # list-listeners are notified of changes to individual list
-        # elements.
         if self._itemAttributes is None: itemAtts = {}
         else:                            itemAtts = self._itemAttributes
 
-- 
GitLab