Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Ying-Qiu Zheng
fsleyes
Commits
d98e9fcf
Commit
d98e9fcf
authored
Feb 18, 2021
by
Paul McCarthy
🚵
Browse files
RF: Use wx query routines from fsleyes_widgets, use new GL info properties in
fsleyes.gl. More to come.
parent
bc2e3fcc
Changes
20
Hide whitespace changes
Inline
Side-by-side
fsleyes/__init__.py
View file @
d98e9fcf
...
...
@@ -203,9 +203,9 @@ import sys
import
logging
import
warnings
from
fsl.utils.
platform
import
platform
as
fslplatform
import
fsl
.utils.settings
as
fslsetting
s
import
fsleyes.version
as
version
import
fsl.utils.
settings
as
fslsettings
import
fsl
eyes_widgets
as
fwidget
s
import
fsleyes.version
as
version
# The logger is assigned in
...
...
@@ -214,7 +214,7 @@ log = None
# If set to True, logging will not be configured
disableLogging
=
f
slplatform
.
frozen
disableLogging
=
f
widgets
.
frozen
()
__version__
=
version
.
__version__
...
...
@@ -277,7 +277,7 @@ def initialise():
# application, we'll guess at the
# location, which will differ depending
# on the platform
if
f
slplatform
.
frozen
:
if
f
widgets
.
frozen
()
:
mac
=
op
.
join
(
fsleyesDir
,
'..'
,
'..'
,
'..'
,
'..'
,
'Resources'
)
lnx
=
op
.
join
(
fsleyesDir
,
'..'
,
'share'
,
'FSLeyes'
)
options
.
append
(
op
.
normpath
(
mac
))
...
...
@@ -328,7 +328,7 @@ def _hacksAndWorkarounds():
# n.b. This will cause issues if building FSLeyes
# with the pyinstaller '--onefile' option, as
# discussed in the above pyinstaller file.
if
f
slplatform
.
frozen
:
if
f
widgets
.
frozen
()
:
os
.
environ
.
pop
(
'MPLCONFIGDIR'
,
None
)
# nibabel rejects NIfTI images where the
...
...
@@ -357,7 +357,7 @@ def _hacksAndWorkarounds():
# Add the current directory to the python
# path, so that modules can be imported
# from within notebook/shell environments
if
f
slplatform
.
frozen
:
if
f
widgets
.
frozen
()
:
sys
.
path
.
insert
(
0
,
''
)
...
...
@@ -383,7 +383,7 @@ def configLogging(verbose=0, noisy=None):
noisy
=
[]
# Show deprecations if running from code
if
f
slplatform
.
frozen
:
if
f
widgets
.
frozen
()
:
warnings
.
filterwarnings
(
'ignore'
,
category
=
DeprecationWarning
)
else
:
warnings
.
filterwarnings
(
'default'
,
category
=
DeprecationWarning
)
...
...
fsleyes/about.py
View file @
d98e9fcf
...
...
@@ -13,8 +13,8 @@ import os.path as op
import
wx
import
fsleyes_widgets.imagepanel
as
imagepanel
from
fsl.utils.platform
import
platform
as
fslplatform
import
fsleyes_widgets.imagepanel
as
imagepanel
import
fsleyes.gl
as
fslgl
import
fsleyes.strings
as
strings
import
fsleyes.splash
as
splash
...
...
@@ -57,8 +57,9 @@ class AboutDialog(wx.Dialog):
# Create / retrieve all the content
verStr
=
version
.
__version__
glVerStr
=
fslplatform
.
glVersion
glRenStr
=
fslplatform
.
glRenderer
glVerStr
=
fslgl
.
GL_VERSION
glRenStr
=
fslgl
.
GL_RENDERER
glCompat
=
fslgl
.
GL_COMPATIBILITY
swlibs
=
strings
.
about
[
'libs'
]
swVersions
=
[]
...
...
@@ -84,7 +85,7 @@ class AboutDialog(wx.Dialog):
fslVer
=
strings
.
about
[
'fslVersion'
].
format
(
fslplatform
.
fslVersion
)
fslDir
=
strings
.
about
[
'fslPath'
]
.
format
(
fslplatform
.
fsldir
)
glVerStr
=
strings
.
about
[
'glVersion'
]
.
format
(
glVerStr
)
glCompat
=
strings
.
about
[
'glCompat'
]
.
format
(
fslgl
.
GL_VERSION
)
glCompat
=
strings
.
about
[
'glCompat'
]
.
format
(
glCompat
)
glRenStr
=
strings
.
about
[
'glRenderer'
].
format
(
glRenStr
)
swStr
=
strings
.
about
[
'software'
]
.
format
(
*
swVersions
)
...
...
fsleyes/actions/about.py
View file @
d98e9fcf
...
...
@@ -11,7 +11,7 @@ displays an about dialog for *FSLeyes*.
from
.
import
base
from
fsl.utils.platform
import
platform
as
fslplatform
import
fsleyes_widgets
as
fwidgets
class
AboutAction
(
base
.
Action
):
...
...
@@ -41,5 +41,5 @@ class AboutAction(base.Action):
# When running over X11/SSH, CentreOnParent
# causes the dialog to be moved way off.
if
not
f
slplatform
.
inSSHSession
:
if
not
f
widgets
.
inSSHSession
()
:
dlg
.
CentreOnParent
()
fsleyes/actions/diagnosticreport.py
View file @
d98e9fcf
...
...
@@ -16,11 +16,10 @@ import logging
import
platform
from
collections
import
OrderedDict
from
fsl.utils.platform
import
platform
as
fslplatform
import
fsleyes_widgets.utils.status
as
status
import
fsleyes.strings
as
strings
import
fsleyes.state
as
fslstate
from
.
import
base
import
fsleyes_widgets.utils.status
as
status
import
fsleyes.strings
as
strings
import
fsleyes.state
as
fslstate
from
.
import
base
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -135,18 +134,17 @@ class DiagnosticReportAction(base.Action):
OpenGL platform.
"""
import
OpenGL.GL
as
gl
import
fsleyes.gl
as
fslgl
import
OpenGL.GL
as
gl
report
=
OrderedDict
()
version
=
gl
.
glGetString
(
gl
.
GL_VERSION
)
.
decode
(
'ascii'
)
renderer
=
gl
.
glGetString
(
gl
.
GL_RENDERER
)
.
decode
(
'ascii'
)
texsize
=
str
(
gl
.
glGetInteger
(
gl
.
GL_MAX_TEXTURE_SIZE
))
extensions
=
gl
.
glGetString
(
gl
.
GL_EXTENSIONS
).
decode
(
'ascii'
)
report
[
'Version'
]
=
version
report
[
'Compatibility'
]
=
fslplatform
.
glVersion
report
[
'Renderer'
]
=
renderer
report
[
'Texture size'
]
=
str
(
gl
.
glGetInteger
(
gl
.
GL_MAX_TEXTURE_SIZE
))
report
=
OrderedDict
()
report
[
'Version'
]
=
fslgl
.
GL_VERSION
report
[
'Compatibility'
]
=
fslgl
.
GL_COMPATIBILITY
report
[
'Renderer'
]
=
fslgl
.
GL_RENDERER
report
[
'Texture size'
]
=
texsize
report
[
'Extensions'
]
=
extensions
.
split
(
' '
)
return
report
...
...
fsleyes/actions/notebook.py
View file @
d98e9fcf
...
...
@@ -28,20 +28,20 @@ import webbrowser
import
wx
import
jinja2
as
j2
import
fsleyes_widgets
.utils.progress
as
progres
s
import
fsleyes_widgets.utils.
status
as
statu
s
import
fsl
.utils.settings
as
s
etting
s
from
fsl.utils.
platform
import
platform
as
fslplatform
import
fsl.utils.tempdir
as
tempdir
import
fsl.utils.idle
as
idle
import
fsleyes_widgets
as
fwidget
s
import
fsleyes_widgets.utils.
progress
as
progres
s
import
fsl
eyes_widgets.utils.status
as
s
tatu
s
import
fsl.utils.
settings
as
settings
import
fsl.utils.tempdir
as
tempdir
import
fsl.utils.idle
as
idle
import
fsleyes
import
fsleyes.main
as
fsleyes_main
import
fsleyes.strings
as
strings
import
fsleyes.actions.screenshot
as
screenshot
import
fsleyes
import
fsleyes.main
as
fsleyes_main
import
fsleyes.strings
as
strings
import
fsleyes.actions.screenshot
as
screenshot
from
.
import
base
from
.
import
runscript
from
.
import
base
from
.
import
runscript
try
:
import
zmq
...
...
@@ -602,7 +602,7 @@ class NotebookServer(threading.Thread):
# can't just call a python interpreter,
# so we use a hook in fsleyes.main to
# call actions.notebook_main.main.
if
f
slplatform
.
frozen
:
if
f
widgets
.
frozen
()
:
cmd
=
[
op
.
join
(
op
.
dirname
(
sys
.
executable
),
'fsleyes'
)]
else
:
cmd
=
[
sys
.
executable
,
fsleyes_main
.
__file__
]
...
...
fsleyes/actions/screenshot.py
View file @
d98e9fcf
...
...
@@ -31,6 +31,7 @@ import matplotlib.image as mplimg
from
fsl.utils.platform
import
platform
as
fslplatform
import
fsl.utils.idle
as
idle
import
fsleyes_widgets
as
fwidgets
import
fsleyes_widgets.utils.status
as
status
import
fsl.utils.settings
as
fslsettings
import
fsleyes.views.canvaspanel
as
canvaspanel
...
...
@@ -181,7 +182,7 @@ def canvasPanelScreenshot(panel, filename):
windowDC
=
wx
.
WindowDC
(
panel
)
memoryDC
=
wx
.
MemoryDC
()
if
f
slplatform
.
wxFlavour
==
f
slplatform
.
WX_PHOENIX
:
if
f
widgets
.
wxFlavour
()
==
f
widgets
.
WX_PHOENIX
:
bmp
=
wx
.
Bitmap
(
width
,
height
)
else
:
bmp
=
wx
.
EmptyBitmap
(
width
,
height
)
...
...
@@ -205,7 +206,7 @@ def canvasPanelScreenshot(panel, filename):
data
[:,
:,
:
3
]
=
rgb
.
reshape
(
height
,
width
,
3
)
# OSX and SSh/X11 both have complications
inSSH
=
f
slplatform
.
inSSHSession
and
not
f
slplatform
.
inVNCSession
inSSH
=
f
widgets
.
inSSHSession
()
and
not
f
widgets
.
inVNCSession
()
if
inSSH
or
fslplatform
.
os
==
'Darwin'
:
data
=
_patchInCanvases
(
cpanel
,
panel
,
data
,
bgColour
)
...
...
fsleyes/displaycontext/maskopts.py
View file @
d98e9fcf
...
...
@@ -12,10 +12,10 @@ for displaying an :class:`.Image` overlay as a binary mask.
import
copy
import
logging
import
fsleyes_props
as
props
from
fsl.utils.platform
import
platform
as
fslplatform
from
.
import
volumeopts
from
.
import
niftiopts
import
fsleyes_props
as
props
import
fsleyes.gl
as
fslgl
from
.
import
volumeopts
from
.
import
niftiopts
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -65,7 +65,7 @@ class MaskOpts(niftiopts.NiftiOpts):
# We need GL >= 2.1 for
# spline interpolation
if
float
(
fsl
platform
.
glVersion
)
<
2.1
:
if
float
(
fsl
gl
.
GL_COMPATIBILITY
)
<
2.1
:
interp
=
self
.
getProp
(
'interpolation'
)
interp
.
removeChoice
(
'spline'
,
instance
=
self
)
interp
.
updateChoice
(
'linear'
,
instance
=
self
,
newAlt
=
[
'spline'
])
...
...
fsleyes/displaycontext/mipopts.py
View file @
d98e9fcf
...
...
@@ -15,12 +15,12 @@ MIP overlays are rendered via the :class:`.GLMIP` class.
import
numpy
as
np
from
fsl.utils.platform
import
platform
as
fslplatform
import
fsl
.transform.affine
as
affine
import
fsleyes
_props
as
props
import
fsl.transform.affine
as
affine
import
fsl
eyes_props
as
props
import
fsleyes
.gl
as
fslgl
from
.
import
colourmapopts
as
cmapopts
from
.
import
niftiopts
from
.
import
colourmapopts
as
cmapopts
from
.
import
niftiopts
class
MIPOpts
(
cmapopts
.
ColourMapOpts
,
niftiopts
.
NiftiOpts
):
...
...
@@ -61,7 +61,7 @@ class MIPOpts(cmapopts.ColourMapOpts, niftiopts.NiftiOpts):
# We need GL >= 2.1 for
# spline interpolation
if
float
(
fsl
platform
.
glVersion
)
<
2.1
:
if
float
(
fsl
gl
.
GL_COMPATIBILITY
)
<
2.1
:
interp
=
self
.
getProp
(
'interpolation'
)
interp
.
removeChoice
(
'spline'
,
instance
=
self
)
interp
.
updateChoice
(
'linear'
,
instance
=
self
,
newAlt
=
[
'spline'
])
...
...
fsleyes/displaycontext/sceneopts.py
View file @
d98e9fcf
...
...
@@ -12,9 +12,9 @@ settings used by :class:`.CanvasPanel` instances.
import
copy
import
logging
from
fsl.utils.platform
import
platform
as
fslplatform
import
fsleyes
_props
as
props
import
fsleyes.colourmaps
as
fslcm
import
fsleyes_props
as
props
import
fsleyes
.gl
as
fslgl
import
fsleyes.colourmaps
as
fslcm
from
.
import
canvasopts
...
...
@@ -121,22 +121,16 @@ class SceneOpts(props.HasProperties):
@
property
def
defaultMovieSyncRefresh
(
self
):
"""In movie mode, the canvas refreshes are performed by the
__syncMovieRefresh or __unsyncMovieRefresh methods of the CanvasPanel
class. Some platforms/GL drivers/environments seem to have a problem
with separate renders/buffer swaps, so we have to use a shitty
unsynchronised update routine.
These heuristics are not perfect - the movieSyncRefresh property can
therefore be overridden by the user.
"""
# In movie mode, the canvas refreshes are
# performed by the __syncMovieRefresh or
# __unsyncMovieRefresh methods of the
# CanvasPanel class. Some platforms/GL
# drivers/environments seem to have a
# problem with separate renders/buffer
# swaps, so we have to use a shitty
# unsynchronised update routine.
#
# These heuristics are not perfect - the
# movieSyncRefresh property can therefore
# be overridden by the user.
"""
renderer
=
fslplatform
.
glRenderer
.
lower
()
renderer
=
fslgl
.
GL_RENDERER
.
lower
()
unsyncRenderers
=
[
'gallium'
,
'mesa dri intel(r)'
]
unsync
=
any
([
r
in
renderer
for
r
in
unsyncRenderers
])
...
...
fsleyes/displaycontext/vectoropts.py
View file @
d98e9fcf
...
...
@@ -12,11 +12,11 @@ vector images.
import
copy
import
fsleyes_props
as
props
import
fsl.data.image
as
fslimage
from
fsl.utils.platform
import
platform
as
fslplatform
from
.
import
niftiopts
from
.
import
volumeopts
import
fsleyes_props
as
props
import
fsl.data.image
as
fslimage
import
fsleyes.gl
as
fslgl
from
.
import
niftiopts
from
.
import
volumeopts
class
VectorOpts
(
niftiopts
.
NiftiOpts
):
...
...
@@ -337,7 +337,7 @@ class RGBVectorOpts(VectorOpts):
# We need GL >= 2.1 for
# spline interpolation
if
float
(
fsl
platform
.
glVersion
)
<
2.1
:
if
float
(
fsl
gl
.
GL_COMPATIBILITY
)
<
2.1
:
interp
=
self
.
getProp
(
'interpolation'
)
interp
.
removeChoice
(
'spline'
,
instance
=
self
)
interp
.
updateChoice
(
'linear'
,
instance
=
self
,
newAlt
=
[
'spline'
])
...
...
fsleyes/displaycontext/volume3dopts.py
View file @
d98e9fcf
...
...
@@ -10,10 +10,11 @@ use with :class:`.DisplayOpts` classes.
import
numpy
as
np
from
fsl.utils.platform
import
platform
as
fslplatform
import
fsl.transform.affine
as
affine
import
fsl.utils.deprecated
as
deprecated
import
fsleyes_props
as
props
import
fsl.transform.affine
as
affine
import
fsl.utils.deprecated
as
deprecated
import
fsleyes_props
as
props
import
fsleyes_widgets
as
fwidgets
import
fsleyes.gl
as
fslgl
class
Volume3DOpts
(
object
):
...
...
@@ -131,7 +132,7 @@ class Volume3DOpts(object):
# If we're in an X11/SSh session,
# step down the quality so it's
# a bit faster.
if
f
slplatform
.
inSSHSession
:
if
f
widgets
.
inSSHSession
()
:
self
.
numSteps
=
60
self
.
resolution
=
70
self
.
blendFactor
=
0.3
...
...
@@ -143,7 +144,7 @@ class Volume3DOpts(object):
#
# Also disable blendByIntensity,
# as it is not implemented on gl14
if
float
(
fsl
platform
.
glVersion
)
<
2.1
:
if
float
(
fsl
gl
.
GL_COMPATIBILITY
)
<
2.1
:
smooth
=
self
.
getProp
(
'smoothing'
)
smooth
.
setAttribute
(
self
,
'maxval'
,
6
)
self
.
disableProperty
(
'blendByIntensity'
)
...
...
@@ -182,7 +183,7 @@ class Volume3DOpts(object):
See the :class:`.GLVolume` class for more details.
"""
if
float
(
fsl
platform
.
glVersion
)
>=
2.1
:
if
float
(
fsl
gl
.
GL_COMPATIBILITY
)
>=
2.1
:
return
self
.
numSteps
outer
=
self
.
getNumOuterSteps
()
...
...
fsleyes/displaycontext/volumeopts.py
View file @
d98e9fcf
...
...
@@ -12,9 +12,9 @@ import logging
import
numpy
as
np
import
fsl.data.image
as
fslimage
from
fsl.utils.platform
import
platform
as
fslplatform
import
fsleyes
_props
as
props
import
fsl.data.image
as
fslimage
import
fsleyes_props
as
props
import
fsleyes
.gl
as
fslgl
import
fsleyes.colourmaps
as
fslcm
from
.
import
colourmapopts
as
cmapopts
...
...
@@ -118,7 +118,7 @@ class VolumeOpts(cmapopts.ColourMapOpts,
# We need GL >= 2.1 for
# spline interpolation
if
float
(
fsl
platform
.
glVersion
)
<
2.1
:
if
float
(
fsl
gl
.
GL_COMPATIBILITY
)
<
2.1
:
interp
=
self
.
getProp
(
'interpolation'
)
interp
.
removeChoice
(
'spline'
,
instance
=
self
)
interp
.
updateChoice
(
'linear'
,
instance
=
self
,
newAlt
=
[
'spline'
])
...
...
@@ -494,7 +494,7 @@ class VolumeRGBOpts(niftiopts.NiftiOpts):
# We need GL >= 2.1 for
# spline interpolation
if
float
(
fsl
platform
.
glVersion
)
<
2.1
:
if
float
(
fsl
gl
.
GL_COMPATIBILITY
)
<
2.1
:
interp
=
self
.
getProp
(
'interpolation'
)
interp
.
removeChoice
(
'spline'
,
instance
=
self
)
interp
.
updateChoice
(
'linear'
,
instance
=
self
,
newAlt
=
[
'spline'
])
...
...
fsleyes/frame.py
View file @
d98e9fcf
...
...
@@ -20,19 +20,19 @@ import logging
import
six
import
wx
import
wx.lib.agw.aui
as
aui
import
wx.lib.agw.aui
as
aui
import
fsl.utils.idle
as
idle
import
fsl.utils.settings
as
fslsettings
import
fsl.utils.deprecated
as
deprecated
from
fsl.utils.platform
import
platform
as
fslplatform
import
fsleyes_widgets.dialog
as
fsldlg
import
fsleyes_widgets.utils.status
as
status
import
fsl.utils.idle
as
idle
import
fsl.utils.settings
as
fslsettings
import
fsl.utils.deprecated
as
deprecated
import
fsleyes_widgets
as
fwidgets
import
fsleyes_widgets.dialog
as
fsldlg
import
fsleyes_widgets.utils.status
as
status
import
fsleyes.strings
as
strings
import
fsleyes.plugins
as
plugins
import
fsleyes.autodisplay
as
autodisplay
import
fsleyes.profiles.shortcuts
as
shortcuts
import
fsleyes.strings
as
strings
import
fsleyes.plugins
as
plugins
import
fsleyes.autodisplay
as
autodisplay
import
fsleyes.profiles.shortcuts
as
shortcuts
from
.
import
actions
from
.
import
tooltips
...
...
@@ -1515,10 +1515,10 @@ class FSLeyesFrame(wx.Frame):
# than the menu bar on OSX/wxPhoenix, or on Linux.
# This is because under OSX/wxPython, we can't get
# access to the built-in application menu.
onOSX
=
f
slplatform
.
wxPlatform
in
(
f
slplatform
.
WX_MAC_CARBON
,
fslplatform
.
WX_MAC_COCOA
)
onOSX
=
f
widgets
.
wxPlatform
()
in
(
f
widgets
.
WX_MAC_CARBON
,
fwidgets
.
WX_MAC_COCOA
)
haveAppMenu
=
(
onOSX
and
f
slplatform
.
wxFlavour
==
f
slplatform
.
WX_PHOENIX
)
f
widgets
.
wxFlavour
()
==
f
widgets
.
WX_PHOENIX
)
locationOffset
=
0
# On linux, we create a FSLeyes menu
...
...
@@ -1725,7 +1725,7 @@ class FSLeyesFrame(wx.Frame):
for
path
in
self
.
__recentPathsMenu
.
GetMenuItems
():
# RemoveItem is deprecated in phoenix
if
f
slplatform
.
wxFlavour
==
f
slplatform
.
WX_PHOENIX
:
if
f
widgets
.
wxFlavour
()
==
f
widgets
.
WX_PHOENIX
:
self
.
__recentPathsMenu
.
Remove
(
path
)
else
:
self
.
__recentPathsMenu
.
RemoveItem
(
path
)
...
...
fsleyes/gl/glvolume.py
View file @
d98e9fcf
...
...
@@ -12,18 +12,17 @@ encapsulates the data and logic required to render 2D slice of an
import
logging
import
numpy
as
np
import
OpenGL.GL
as
gl
import
numpy
as
np
import
OpenGL.GL
as
gl
from
fsl.utils.platform
import
platform
as
fslplatform
import
fsl.utils.idle
as
idle
import
fsl.transform.affine
as
affine
import
fsleyes.gl
as
fslgl
import
fsleyes.gl.routines
as
glroutines
import
fsleyes.gl.shaders.filter
as
glfilter
from
.
import
textures
from
.
import
glimageobject
from
.
import
resources
as
glresources
import
fsl.utils.idle
as
idle
import
fsl.transform.affine
as
affine
import
fsleyes.gl
as
fslgl
import
fsleyes.gl.routines
as
glroutines
import
fsleyes.gl.shaders.filter
as
glfilter
from
.
import
textures
from
.
import
glimageobject
from
.
import
resources
as
glresources
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -1051,7 +1050,7 @@ class GLVolume(glimageobject.GLImageObject):
"""Called when the :attr:`.Volume3DOpts.numClipPlanes` property
changes.
"""
if
float
(
fsl
platform
.
glVersion
)
==
1.4
:
if
float
(
fsl
gl
.
GL_COMPATIBILITY
)
==
1.4
:
fslgl
.
glvolume_funcs
.
compileShaders
(
self
)
self
.
updateShaderState
(
alwaysNotify
=
True
)
...
...
@@ -1060,7 +1059,7 @@ class GLVolume(glimageobject.GLImageObject):
"""Called when the :attr:`.Volume3DOpts.clipMode` property
changes.
"""
if
float
(
fsl
platform
.
glVersion
)
==
1.4
:
if
float
(
fsl
gl
.
GL_COMPATIBILITY
)
==
1.4
:
fslgl
.
glvolume_funcs
.
compileShaders
(
self
)
self
.
updateShaderState
(
alwaysNotify
=
True
)
...
...
fsleyes/gl/shaders/filter.py
View file @
d98e9fcf
...
...
@@ -12,11 +12,10 @@ to loading and running simple filter shader programs, which require a
import
collections
import
OpenGL.GL
as
gl
import
OpenGL.GL
as
gl
from
fsl.utils.platform
import
platform
as
fslplatform
import
fsleyes.gl.shaders
as
shaders
import
fsleyes.gl
as
fslgl
import
fsleyes.gl.shaders
as
shaders
GL14_CONSTANTS
=
collections
.
defaultdict
(
dict
,
{
...
...
@@ -74,7 +73,7 @@ class Filter(object):
self
.
__texture
=
texture
self
.
__basename
=
basename
if
float
(
fsl
platform
.
glVersion
)
>=
2.1
:
if
float
(
fsl
gl
.
GL_COMPATIBILITY
)
>=
2.1
:
self
.
__shader
=
shaders
.
GLSLShader
(
vertSrc
,
fragSrc
)
else
:
constants
=
{
n
:
1
for
n
in
GL14_CONSTANTS
[
basename
]}
...
...
@@ -110,7 +109,7 @@ class Filter(object):
shader
.
load
()
kwargs
=
dict
(
kwargs
)
glver
=
float
(
fsl
platform
.
glVersion
)
glver
=
float
(
fsl
gl
.
GL_COMPATIBILITY
)
needRecompile
=
False
if
glver
>=
2.1
:
...
...
@@ -172,7 +171,7 @@ class Filter(object):
shader
.
loadAtts
()
shader
.
setAtt
(
'texCoord'
,
texCoords
)
if
float
(
fsl
platform
.
glVersion
)
>=
2.1
:
if
float
(
fsl
gl
.
GL_COMPATIBILITY
)
>=
2.1
:
shader
.
setAtt
(
'vertex'
,
vertices
)
source
.
draw
(
**
kwargs
)
else
:
...
...
fsleyes/gl/textures/imagetexture.py
View file @
d98e9fcf
...
...
@@ -16,12 +16,12 @@ import collections.abc as abc
import
numpy
as
np
import
fsl.transform.affine
as
affine
import
fsl.data.imagewrapper
as
imagewrapper
from
fsl.utils.platform
import
platform
as
fslplatform
from
.
import
data
as
texdata
from
.
import
texture2d
from
.
import
texture3d
import
fsl.transform.affine
as
affine
import
fsl.data.imagewrapper
as
imagewrapper
import
fsleyes_widgets
as
fwidgets
from
.
import
data
as
texdata
from
.
import
texture2d
from
.
import
texture3d
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -349,7 +349,7 @@ class ImageTexture(ImageTextureBase, texture3d.Texture3D):
threadedDefault
=
None
"""Default value used for the ``threaded`` argument passed to
:meth:`__init__`. When this is set to ``None``, the default value will be
the value of :
attr
:`.fsl
.utils.platform.Platform
.haveGui`.
the value of :
func
:`.fsl
eyes_widgets
.haveGui`.
"""
...
...
@@ -401,7 +401,7 @@ class ImageTexture(ImageTextureBase, texture3d.Texture3D):
ImageTexture
.
threadedDefault
)
if
kwargs
[
'threaded'
]
is
None
:
kwargs
[
'threaded'
]
=
f
slplatform
.
haveGui
kwargs
[
'threaded'
]
=
f
widgets
.
haveGui
()
ImageTextureBase
.
__init__
(
self
,
image
,
nvals
,
3
)
texture3d
.
Texture3D
.
__init__
(
self
,
name
,
**
kwargs
)
...
...
fsleyes/gl/textures/rendertexture.py
View file @
d98e9fcf
...
...
@@ -23,10 +23,10 @@ import OpenGL.GL as gl
import
OpenGL.raw.GL._types
as
gltypes
import
OpenGL.GL.EXT.framebuffer_object
as
glfbo
from
fsl.utils.platform
import
platform
as
fslplatform
import
fsleyes.gl.routines
as
glroutines
import
fsleyes.gl.shaders
as
shaders
from
.
import
texture2d
import
fsleyes.gl
as
fslgl
import
fsleyes.gl.routines
as
glroutines
import
fsleyes.gl.shaders
as
shaders
from
.
import
texture2d
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -163,7 +163,7 @@ class RenderTexture(texture2d.Texture2D):
fragSrc
=
shaders
.
getFragmentShader
(
'rendertexture'
)