Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Michiel Cottaar
fslpy
Commits
d3a75ad7
Commit
d3a75ad7
authored
8 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
New Nifti methods to return xyzt unit codes - nibabel returns labels, but I
want the raw codes.
parent
b5f7caa3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/data/image.py
+23
-1
23 additions, 1 deletion
fsl/data/image.py
with
23 additions
and
1 deletion
fsl/data/image.py
+
23
−
1
View file @
d3a75ad7
...
@@ -42,7 +42,6 @@ import numpy as np
...
@@ -42,7 +42,6 @@ import numpy as np
import
nibabel
as
nib
import
nibabel
as
nib
import
nibabel.fileslice
as
fileslice
import
nibabel.fileslice
as
fileslice
import
fsl.utils.transform
as
transform
import
fsl.utils.transform
as
transform
import
fsl.utils.notifier
as
notifier
import
fsl.utils.notifier
as
notifier
import
fsl.utils.memoize
as
memoize
import
fsl.utils.memoize
as
memoize
...
@@ -314,6 +313,29 @@ class Nifti(notifier.Notifier):
...
@@ -314,6 +313,29 @@ class Nifti(notifier.Notifier):
return
self
.
__intent
return
self
.
__intent
@property
def
xyzUnits
(
self
):
"""
Returns the NIFTI XYZ dimension unit code.
"""
# The nibabel get_xyzt_units returns labels,
# but we want the NIFTI codes. So we use
# the (undocumented) nifti1.unit_codes field
# to convert back to the raw codes.
xyzUnits
=
self
.
header
.
get_xyzt_units
()[
0
]
xyzUnits
=
nib
.
nifti1
.
unit_codes
[
xyzUnits
]
return
xyzUnits
def
timeUnits
(
self
):
"""
Returns the NIFTI time dimension unit code.
"""
# See xyzUnits
timeUnits
=
self
.
header
.
get_xyzt_units
()[
1
]
timeUnits
=
nib
.
nifti1
.
unit_codes
[
timeUnits
]
return
timeUnits
@property
@property
def
worldToVoxMat
(
self
):
def
worldToVoxMat
(
self
):
"""
Returns a ``numpy`` array of shape ``(4, 4)`` containing an
"""
Returns a ``numpy`` array of shape ``(4, 4)`` containing an
...
...
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