From d98c6d1d9ea1171271036a04b1792e2b2f7c28af Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauld.mccarthy@gmail.com>
Date: Mon, 14 Mar 2016 11:55:48 +0000
Subject: [PATCH] Bugfix - clipping ranges made less restrictive as, after
 transformation between original data range, data-type range, and texture
 (0-1) range, 16 bit data can become inaccurate for mask images.

---
 fsl/fsleyes/displaycontext/maskopts.py   | 2 +-
 fsl/fsleyes/displaycontext/vectoropts.py | 2 +-
 fsl/fsleyes/displaycontext/volumeopts.py | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fsl/fsleyes/displaycontext/maskopts.py b/fsl/fsleyes/displaycontext/maskopts.py
index 64fc9b674..aae45f9ac 100644
--- a/fsl/fsleyes/displaycontext/maskopts.py
+++ b/fsl/fsleyes/displaycontext/maskopts.py
@@ -54,7 +54,7 @@ class MaskOpts(volumeopts.Nifti1Opts):
             self.dataMax = float(overlay.data.max())
 
         dRangeLen    = abs(self.dataMax - self.dataMin)
-        dMinDistance = dRangeLen / 10000.0
+        dMinDistance = dRangeLen / 100.0
 
         #################
         # This is a hack.
diff --git a/fsl/fsleyes/displaycontext/vectoropts.py b/fsl/fsleyes/displaycontext/vectoropts.py
index 5b6a68e47..dcfb79f46 100644
--- a/fsl/fsleyes/displaycontext/vectoropts.py
+++ b/fsl/fsleyes/displaycontext/vectoropts.py
@@ -148,7 +148,7 @@ class VectorOpts(volumeopts.Nifti1Opts):
         # we add an offset allowing the user
         # to configure the overlay such that
         # no voxels are clipped.
-        distance = (maxval - minval) / 10000.0
+        distance = (maxval - minval) / 100.0
 
         self.clippingRange.xmin =  minval - distance
         self.clippingRange.xmax =  maxval + distance
diff --git a/fsl/fsleyes/displaycontext/volumeopts.py b/fsl/fsleyes/displaycontext/volumeopts.py
index e26646a3a..011a53479 100644
--- a/fsl/fsleyes/displaycontext/volumeopts.py
+++ b/fsl/fsleyes/displaycontext/volumeopts.py
@@ -793,7 +793,7 @@ class VolumeOpts(Nifti1Opts):
         # a small offset to the clipping limits
         # so the user can configure the scene such
         # that no values are clipped.
-        distance = abs(dmax - dmin) / 10000.0
+        distance = abs(dmax - dmin) / 100.0
 
         self.clippingRange.xmin = dmin - distance
         self.clippingRange.xmax = dmax + distance
-- 
GitLab