Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSL
fslpy
Commits
a5ab9521
Commit
a5ab9521
authored
9 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
VectorOpts.modulate property supports 4D images.
parent
dd7e8a26
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fsl/fsleyes/displaycontext/vectoropts.py
+6
-4
6 additions, 4 deletions
fsl/fsleyes/displaycontext/vectoropts.py
fsl/fsleyes/gl/glvector.py
+49
-2
49 additions, 2 deletions
fsl/fsleyes/gl/glvector.py
with
55 additions
and
6 deletions
fsl/fsleyes/displaycontext/vectoropts.py
+
6
−
4
View file @
a5ab9521
...
@@ -123,10 +123,12 @@ class VectorOpts(volumeopts.ImageOpts):
...
@@ -123,10 +123,12 @@ class VectorOpts(volumeopts.ImageOpts):
if
not
isinstance
(
overlay
,
fslimage
.
Image
):
if
not
isinstance
(
overlay
,
fslimage
.
Image
):
continue
continue
# an image can only be used to modulate
# an image can only be used to
# the vector image if it shares the same
# modulate the vector image if
# dimensions as said vector image
# it shares the same dimensions
if
overlay
.
shape
!=
self
.
overlay
.
shape
[:
3
]:
# as said vector image. 4D
# images are ok though.
if
overlay
.
shape
[:
3
]
!=
self
.
overlay
.
shape
[:
3
]:
continue
continue
modOptions
.
append
(
overlay
)
modOptions
.
append
(
overlay
)
...
...
This diff is collapsed.
Click to expand it.
fsl/fsleyes/gl/glvector.py
+
49
−
2
View file @
a5ab9521
...
@@ -87,6 +87,7 @@ class GLVector(globject.GLImageObject):
...
@@ -87,6 +87,7 @@ class GLVector(globject.GLImageObject):
self
.
xColourTexture
=
textures
.
ColourMapTexture
(
'
{}_x
'
.
format
(
name
))
self
.
xColourTexture
=
textures
.
ColourMapTexture
(
'
{}_x
'
.
format
(
name
))
self
.
yColourTexture
=
textures
.
ColourMapTexture
(
'
{}_y
'
.
format
(
name
))
self
.
yColourTexture
=
textures
.
ColourMapTexture
(
'
{}_y
'
.
format
(
name
))
self
.
zColourTexture
=
textures
.
ColourMapTexture
(
'
{}_z
'
.
format
(
name
))
self
.
zColourTexture
=
textures
.
ColourMapTexture
(
'
{}_z
'
.
format
(
name
))
self
.
modImage
=
None
self
.
modTexture
=
None
self
.
modTexture
=
None
self
.
imageTexture
=
None
self
.
imageTexture
=
None
self
.
prefilter
=
prefilter
self
.
prefilter
=
prefilter
...
@@ -110,10 +111,12 @@ class GLVector(globject.GLImageObject):
...
@@ -110,10 +111,12 @@ class GLVector(globject.GLImageObject):
glresources
.
delete
(
self
.
imageTexture
.
getTextureName
())
glresources
.
delete
(
self
.
imageTexture
.
getTextureName
())
glresources
.
delete
(
self
.
modTexture
.
getTextureName
())
glresources
.
delete
(
self
.
modTexture
.
getTextureName
())
self
.
removeListeners
()
self
.
deregisterModulateImage
()
self
.
imageTexture
=
None
self
.
imageTexture
=
None
self
.
modTexture
=
None
self
.
modTexture
=
None
self
.
modImage
=
None
self
.
removeListeners
()
globject
.
GLImageObject
.
destroy
(
self
)
globject
.
GLImageObject
.
destroy
(
self
)
...
@@ -132,6 +135,8 @@ class GLVector(globject.GLImageObject):
...
@@ -132,6 +135,8 @@ class GLVector(globject.GLImageObject):
self
.
onUpdate
()
self
.
onUpdate
()
def
modUpdate
(
*
a
):
def
modUpdate
(
*
a
):
self
.
deregisterModulateImage
()
self
.
registerModulateImage
()
self
.
refreshModulateTexture
()
self
.
refreshModulateTexture
()
self
.
updateShaderState
()
self
.
updateShaderState
()
self
.
onUpdate
()
self
.
onUpdate
()
...
@@ -266,7 +271,49 @@ class GLVector(globject.GLImageObject):
...
@@ -266,7 +271,49 @@ class GLVector(globject.GLImageObject):
raise
NotImplementedError
(
'
updateShaderState must be implemented by
'
raise
NotImplementedError
(
'
updateShaderState must be implemented by
'
'
{} subclasses
'
.
format
(
type
(
self
).
__name__
))
'
{} subclasses
'
.
format
(
type
(
self
).
__name__
))
def
registerModulateImage
(
self
):
"""
Called when the :attr:`.VectorOpts.modulate` property changes.
Registers a listener with the :attr:`.ImageOpts.volume` property
of the modulate image, so the modulate texture can be updated when
the image volume changes.
"""
modImage
=
self
.
displayOpts
.
modulate
if
modImage
is
None
or
modImage
==
'
none
'
:
self
.
modImage
=
None
else
:
self
.
modImage
=
modImage
if
self
.
modImage
is
None
:
return
modOpts
=
self
.
displayOpts
.
displayCtx
.
getOpts
(
modImage
)
def
volumeChange
(
*
a
):
self
.
modTexture
.
set
(
volume
=
modOpts
.
volume
)
self
.
refreshModulateTexture
()
self
.
onUpdate
()
modOpts
.
addListener
(
'
volume
'
,
self
.
name
,
volumeChange
,
weak
=
False
)
def
deregisterModulateImage
(
self
):
"""
Called when the :attr:`.VectorOpts.modulate` property changes.
Deregisters the :attr:`.ImageOpts.volume` listener that was
registered in :meth:`registerModulateImage`.
"""
if
self
.
modImage
is
None
:
return
modOpts
=
self
.
displayOpts
.
displayCtx
.
getOpts
(
self
.
modImage
)
modOpts
.
removeListener
(
'
volume
'
,
self
.
name
)
self
.
modImage
=
None
def
refreshModulateTexture
(
self
):
def
refreshModulateTexture
(
self
):
"""
Called when the :attr`.VectorOpts.modulate` property changes.
"""
Called when the :attr`.VectorOpts.modulate` property changes.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment