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
a9ea74ca
Commit
a9ea74ca
authored
8 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Nifti intent codes added to fsl.data.constants. Nifti1 instances have an
'intent' attribute.
parent
f39e5927
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/data/constants.py
+58
-0
58 additions, 0 deletions
fsl/data/constants.py
fsl/data/image.py
+8
-4
8 additions, 4 deletions
fsl/data/image.py
with
66 additions
and
4 deletions
fsl/data/constants.py
+
58
−
0
View file @
a9ea74ca
...
@@ -79,3 +79,61 @@ NIFTI_XFORM_TALAIRACH = 3
...
@@ -79,3 +79,61 @@ NIFTI_XFORM_TALAIRACH = 3
NIFTI_XFORM_MNI_152
=
4
NIFTI_XFORM_MNI_152
=
4
"""
MNI 152 normalized coordinates.
"""
"""
MNI 152 normalized coordinates.
"""
# NIFTI file intent codes
NIFTI_INTENT_NONE
=
0
NIFTI_INTENT_CORREL
=
2
NIFTI_INTENT_TTEST
=
3
NIFTI_INTENT_FTEST
=
4
NIFTI_INTENT_ZSCORE
=
5
NIFTI_INTENT_CHISQ
=
6
NIFTI_INTENT_BETA
=
7
NIFTI_INTENT_BINOM
=
8
NIFTI_INTENT_GAMMA
=
9
NIFTI_INTENT_POISSON
=
10
NIFTI_INTENT_NORMAL
=
11
NIFTI_INTENT_FTEST_NONC
=
12
NIFTI_INTENT_CHISQ_NONC
=
13
NIFTI_INTENT_LOGISTIC
=
14
NIFTI_INTENT_LAPLACE
=
15
NIFTI_INTENT_UNIFORM
=
16
NIFTI_INTENT_TTEST_NONC
=
17
NIFTI_INTENT_WEIBULL
=
18
NIFTI_INTENT_CHI
=
19
NIFTI_INTENT_INVGAUSS
=
20
NIFTI_INTENT_EXTVAL
=
21
NIFTI_INTENT_PVAL
=
22
NIFTI_INTENT_LOGPVAL
=
23
NIFTI_INTENT_LOG10PVAL
=
24
NIFTI_FIRST_STATCODE
=
2
NIFTI_LAST_STATCODE
=
24
NIFTI_INTENT_ESTIMATE
=
1001
NIFTI_INTENT_LABEL
=
1002
NIFTI_INTENT_NEURONAME
=
1003
NIFTI_INTENT_GENMATRIX
=
1004
NIFTI_INTENT_SYMMATRIX
=
1005
NIFTI_INTENT_DISPVECT
=
1006
NIFTI_INTENT_VECTOR
=
1007
NIFTI_INTENT_POINTSET
=
1008
NIFTI_INTENT_TRIANGLE
=
1009
NIFTI_INTENT_QUATERNION
=
1010
NIFTI_INTENT_DIMLESS
=
1011
NIFTI_INTENT_TIME_SERIES
=
2001
NIFTI_INTENT_NODE_INDEX
=
2002
NIFTI_INTENT_RGB_VECTOR
=
2003
NIFTI_INTENT_RGBA_VECTOR
=
2004
NIFTI_INTENT_SHAPE
=
2005
# FSL-specific intent codes
# FNIRT
FSL_FNIRT_DISPLACEMENT_FIELD
=
2006
FSL_CUBIC_SPLINE_COEFFICIENTS
=
2007
FSL_DCT_COEFFICIENTS
=
2008
FSL_QUADRATIC_SPLINE_COEFFICIENTS
=
2009
# TOPUP
FSL_TOPUP_CUBIC_SPLINE_COEFFICIENTS
=
2016
FSL_TOPUP_QUADRATIC_SPLINE_COEFFICIENTS
=
2017
FSL_TOPUP_FIELD
=
2018
This diff is collapsed.
Click to expand it.
fsl/data/image.py
+
8
−
4
View file @
a9ea74ca
...
@@ -73,6 +73,7 @@ class Nifti1(object):
...
@@ -73,6 +73,7 @@ class Nifti1(object):
``worldToVoxMat`` A 4*4 array specifying the affine transformation
``worldToVoxMat`` A 4*4 array specifying the affine transformation
for transforming real world coordinates into voxel
for transforming real world coordinates into voxel
coordinates.
coordinates.
``intent`` The NIFTI intent code specified in the header.
================= ====================================================
================= ====================================================
...
@@ -100,6 +101,8 @@ class Nifti1(object):
...
@@ -100,6 +101,8 @@ class Nifti1(object):
self
.
header
=
header
self
.
header
=
header
self
.
shape
=
shape
self
.
shape
=
shape
self
.
intent
=
header
.
get
(
'
intent_code
'
,
constants
.
NIFTI_INTENT_NONE
)
self
.
__origShape
=
origShape
self
.
__origShape
=
origShape
self
.
pixdim
=
pixdim
self
.
pixdim
=
pixdim
self
.
voxToWorldMat
=
voxToWorldMat
self
.
voxToWorldMat
=
voxToWorldMat
...
@@ -115,11 +118,12 @@ class Nifti1(object):
...
@@ -115,11 +118,12 @@ class Nifti1(object):
# We have to treat FSL/FNIRT images
# We have to treat FSL/FNIRT images
# specially, as FNIRT clobbers the
# specially, as FNIRT clobbers the
# sform section of the NIFTI header
# sform section of the NIFTI header
# to store other data. The hard coded
# to store other data.
# numbers here are the intent codes
# output by FNIRT.
intent
=
header
.
get
(
'
intent_code
'
,
-
1
)
intent
=
header
.
get
(
'
intent_code
'
,
-
1
)
if
intent
in
(
2006
,
2007
,
2008
,
2009
):
if
intent
in
(
constants
.
FSL_FNIRT_DISPLACEMENT_FIELD
,
constants
.
FSL_CUBIC_SPLINE_COEFFICIENTS
,
constants
.
FSL_DCT_COEFFICIENTS
,
constants
.
FSL_QUADRATIC_SPLINE_COEFFICIENTS
):
log
.
debug
(
'
FNIRT output image detected - using qform matrix
'
)
log
.
debug
(
'
FNIRT output image detected - using qform matrix
'
)
voxToWorldMat
=
np
.
array
(
header
.
get_qform
())
voxToWorldMat
=
np
.
array
(
header
.
get_qform
())
...
...
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