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
69c108ea
Commit
69c108ea
authored
5 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
RF: VoxelwiseEVMixin has a new getData method which takes into account
compressed voxelwise EVs
parent
e8f0a5ad
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/data/featdesign.py
+35
-1
35 additions, 1 deletion
fsl/data/featdesign.py
with
35 additions
and
1 deletion
fsl/data/featdesign.py
+
35
−
1
View file @
69c108ea
...
...
@@ -214,7 +214,7 @@ class FEATFSFDesign(object):
'
for ev {}
'
.
format
(
ev
.
index
))
continue
design
[:,
ev
.
index
]
=
ev
.
image
[
x
,
y
,
z
,
:]
design
[:,
ev
.
index
]
=
ev
.
getData
(
x
,
y
,
z
)
return
design
...
...
@@ -228,6 +228,17 @@ class VoxelwiseEVMixin(object):
``filename`` Path to the image file containing the data for this EV
``image`` Reference to the :class:`.Image` object
============ ======================================================
Some FSL tools (e.g. `PNM
<https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/PNM>`_) generate *compressed*
voxelwise EVs, where there is only one voxel per slice. For example,
if the input data has shape ``(x, y, z, t)``, and slices are acquired
along the Z plane, voxelwise EV files generated by PNM will have shape
``(1, 1, z, t)``.
Therefore, using the :meth:`getData` method is preferable to accessing
the :meth:`image` directly, as ``getData`` will check for compressed
images, and adjust the voxel coordinates accordingly.
"""
def
__init__
(
self
,
filename
):
...
...
@@ -272,6 +283,29 @@ class VoxelwiseEVMixin(object):
return
self
.
__image
def
getData
(
self
,
x
,
y
,
z
):
"""
Returns the data at the specified voxel, taking into account
compressed voxelwise EVs.
"""
image
=
self
.
image
if
image
is
None
:
return
None
dx
,
dy
,
dz
=
image
.
shape
[:
3
]
# "Compressed" images have one voxel
# per slice, i.e. they have shape
# [1, 1, nslices, ntimepoints] (if
# Z is the slice plane).
if
sum
((
dx
==
1
,
dy
==
1
,
dz
==
1
))
==
2
:
if
dx
==
1
:
x
=
0
if
dy
==
1
:
y
=
0
if
dz
==
1
:
z
=
0
return
image
[
x
,
y
,
z
,
:]
class
EV
(
object
):
"""
Class representing an explanatory variable in a FEAT design matrix.
...
...
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