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
03ba3546
Commit
03ba3546
authored
4 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
TEST: Test force warp field intent code
parent
98a8d42c
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
tests/test_transform/test_fnirt.py
+36
-0
36 additions, 0 deletions
tests/test_transform/test_fnirt.py
with
36 additions
and
0 deletions
tests/test_transform/test_fnirt.py
+
36
−
0
View file @
03ba3546
...
...
@@ -9,10 +9,13 @@ import os.path as op
import
itertools
as
it
import
numpy
as
np
import
nibabel
as
nib
import
pytest
import
fsl.data.image
as
fslimage
import
fsl.utils.tempdir
as
tempdir
import
fsl.data.constants
as
constants
import
fsl.transform.affine
as
affine
import
fsl.transform.nonlinear
as
nonlinear
import
fsl.transform.fnirt
as
fnirt
...
...
@@ -51,6 +54,39 @@ def test_readFnirt():
assert
disp
.
refSpace
==
'
fsl
'
def
test_readFnirt_defType_intent
():
src
=
op
.
join
(
datadir
,
'
src.nii.gz
'
)
ref
=
op
.
join
(
datadir
,
'
ref.nii.gz
'
)
coef
=
op
.
join
(
datadir
,
'
coefficientfield.nii.gz
'
)
disp
=
op
.
join
(
datadir
,
'
displacementfield.nii.gz
'
)
src
=
fslimage
.
Image
(
src
)
ref
=
fslimage
.
Image
(
ref
)
field
=
fnirt
.
readFnirt
(
disp
,
src
,
ref
,
defType
=
'
absolute
'
)
assert
field
.
deformationType
==
'
absolute
'
field
=
fnirt
.
readFnirt
(
disp
,
src
,
ref
,
defType
=
'
relative
'
)
assert
field
.
deformationType
==
'
relative
'
img
=
nib
.
load
(
coef
)
img
.
header
[
'
intent_code
'
]
=
0
with
tempdir
.
tempdir
():
img
.
to_filename
(
'
field.nii.gz
'
)
with
pytest
.
raises
(
ValueError
):
fnirt
.
readFnirt
(
'
field
'
,
src
,
ref
)
field
=
fnirt
.
readFnirt
(
'
field
'
,
src
,
ref
,
intent
=
constants
.
FSL_CUBIC_SPLINE_COEFFICIENTS
)
assert
isinstance
(
field
,
nonlinear
.
CoefficientField
)
field
=
fnirt
.
readFnirt
(
'
field
'
,
src
,
ref
,
intent
=
constants
.
FSL_FNIRT_DISPLACEMENT_FIELD
)
assert
isinstance
(
field
,
nonlinear
.
DeformationField
)
def
test_toFnirt
():
def
check
(
got
,
exp
):
...
...
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