diff --git a/fsl/data/strings.py b/fsl/data/strings.py index acc7f1874b7b608c3349553c3c9261f5d680d8ca..f52a33c3d944bc4ac682e5a61eb9816e595b05e1 100644 --- a/fsl/data/strings.py +++ b/fsl/data/strings.py @@ -576,6 +576,7 @@ properties = TypeDict({ 'TensorOpts.lighting' : 'Lighting effects', 'TensorOpts.tensorResolution' : 'Ellipsoid quality', + 'TensorOpts.tensorScale' : 'Tensor size', }) diff --git a/fsl/fsleyes/controls/overlaydisplaypanel.py b/fsl/fsleyes/controls/overlaydisplaypanel.py index 00efee699b083b121128a8734b0ecbc69e98f86c..bcc874128d3f1f6ae3f5a051ba6643b89923c490 100644 --- a/fsl/fsleyes/controls/overlaydisplaypanel.py +++ b/fsl/fsleyes/controls/overlaydisplaypanel.py @@ -377,6 +377,7 @@ _DISPLAY_PROPS = td.TypeDict({ spin=False, labels=[strings.choices['TensorOpts.tensorResolution.min'], strings.choices['TensorOpts.tensorResolution.max']]), + props.Widget('tensorScale', showLimits=False, spin=False), props.Widget('xColour'), props.Widget('yColour'), props.Widget('zColour'), @@ -385,6 +386,7 @@ _DISPLAY_PROPS = td.TypeDict({ props.Widget('suppressZ'), props.Widget('modulateImage', labels=_imageName), props.Widget('clipImage', labels=_imageName), + props.Widget('clipThreshold', showLimits=False, spin=False, diff --git a/fsl/fsleyes/displaycontext/tensoropts.py b/fsl/fsleyes/displaycontext/tensoropts.py index c3b15b34ae2b59bb4619e9bccc2debfbac980c15..4061abffb4c858e0d85e7b9a5cd2419e2859c56a 100644 --- a/fsl/fsleyes/displaycontext/tensoropts.py +++ b/fsl/fsleyes/displaycontext/tensoropts.py @@ -29,7 +29,8 @@ class TensorOpts(vectoropts.VectorOpts): :func:`.routines.unitSphere` function. """ - tensorScale = props.Real(minval=0.0, maxval=5.0, default=1.0) + + tensorScale = props.Percentage(minval=50, maxval=600, default=100) """Scaling factor - by default, the tensor ellipsoids are scaled such that the biggest tensor (as defined by the first principal eigenvalue) fits inside a voxel. This parameter can be used to adjust this scale. diff --git a/fsl/fsleyes/gl/gl21/gltensor_funcs.py b/fsl/fsleyes/gl/gl21/gltensor_funcs.py index b38fbee527a9d7044305391b64ea74e245a16ac5..ba5c87cbe137b8671fc955fedfc532e849a6578c 100644 --- a/fsl/fsleyes/gl/gl21/gltensor_funcs.py +++ b/fsl/fsleyes/gl/gl21/gltensor_funcs.py @@ -181,11 +181,13 @@ def updateShaderState(self): imageShape = np.array(self.image.shape[:3], dtype=np.float32) resolution = opts.tensorResolution clipThreshold = opts.clipThreshold + tensorScale = opts.tensorScale lighting = 1 if opts.lighting else 0 useSpline = 0 - l1 = self.image.L1() - eigValNorm = 0.5 / abs(l1.data).max() + l1 = self.image.L1() + eigValNorm = 0.5 / abs(l1.data).max() + eigValNorm *= tensorScale / 100.0 invClipValXform = self.clipTexture .invVoxValXform clipThreshold = clipThreshold * invClipValXform[0, 0] + \ diff --git a/fsl/fsleyes/gl/gltensor.py b/fsl/fsleyes/gl/gltensor.py index 5df0291ac64611f678400f52520603572886c829..8ef0097a381a17c64746fe3c53841d51b184e5a8 100644 --- a/fsl/fsleyes/gl/gltensor.py +++ b/fsl/fsleyes/gl/gltensor.py @@ -58,6 +58,7 @@ class GLTensor(glvector.GLVector): opts.addListener('lighting', name, shaderUpdate, weak=False) opts.addListener('tensorResolution', name, shaderUpdate, weak=False) + opts.addListener('tensorScale', name, shaderUpdate, weak=False) def removeListeners(self): @@ -71,6 +72,7 @@ class GLTensor(glvector.GLVector): opts.removeListener('lighting', name) opts.removeListener('tensorResolution', name) + opts.removeListener('tensorScale', name) def getDataResolution(self, xax, yax): diff --git a/fsl/fsleyes/gl/shaders.py b/fsl/fsleyes/gl/shaders.py index 6f503e053b0df35208866bad7f6251103ece301e..ad9c40d77e6e7f33d7f4dc1b3ee0dfb017dffc50 100644 --- a/fsl/fsleyes/gl/shaders.py +++ b/fsl/fsleyes/gl/shaders.py @@ -121,7 +121,15 @@ def setFragmentProgramMatrix(index, matrix): def getShaderVars(shaders, vertAtts, vertUniforms, fragUniforms): - """ + """Gets the position indices for all vertex shader attributes, uniforms, + and fragment shader uniforms for the given shader programs. + + :arg shaders: + :arg vertAtts: + :arg vertUniforms: + :arg fragUniforms: + + :returns: """ import OpenGL.GL as gl diff --git a/fsl/fsleyes/tooltips.py b/fsl/fsleyes/tooltips.py index 37834889db58245e26b444bb17ee5eae70f43011..7afa7babf36c51420edaf3ffd0c964ce06f06f5a 100644 --- a/fsl/fsleyes/tooltips.py +++ b/fsl/fsleyes/tooltips.py @@ -186,7 +186,21 @@ properties = TypeDict({ 'setting defines the space, relative to the ' 'reference image, in which the model ' 'coordinates are defined.', - + + 'TensorOpts.lighting' : 'If enabled, a simple lighting model is ' + 'used to highlight the tensor ' + 'orientations.', + 'TensorOpts.tensorResolution' : 'This setting controls the number of ' + 'vertices used to render each tensor. ' + 'A higher value will result in better ' + 'looking tensors, but may reduce ' + 'performance.' , + 'TensorOpts.tensorScale' : 'By default, the tensor radii are scaled ' + 'the largest eigenvalue of the tensor ' + 'matrix, so that the largest tensor is ' + 'drawn to fit within a voxel. This ' + 'setting allows the tensor scale to be ' + 'adjusted.', # SceneOpts 'SceneOpts.showCursor' : 'Show/hide the cursor which highlights '