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
b62cfa88
Commit
b62cfa88
authored
4 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
TEST: Regression test, check coefficient field works with alt ref
parent
f1fbcb32
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_nonlinear.py
+32
-0
32 additions, 0 deletions
tests/test_transform/test_nonlinear.py
with
32 additions
and
0 deletions
tests/test_transform/test_nonlinear.py
+
32
−
0
View file @
b62cfa88
...
...
@@ -311,6 +311,38 @@ def test_CoefficientField_transform():
assert
np
.
all
(
np
.
isclose
(
gotnp
,
srccoordsnp
[
srcspace
],
**
tol
))
def
test_coefficientField_transform_altref
():
# test coordinates (manually determined).
# original ref image is 2mm isotropic,
# resampled is 1mm. Each tuple contains:
#
# (src, ref2mm, ref1mm)
coords
=
[
((
18.414
,
26.579
,
25.599
),
(
11
,
19
,
11
),
(
22
,
38
,
22
)),
((
14.727
,
22.480
,
20.340
),
(
8
,
17
,
8
),
(
16
,
34
,
16
)),
((
19.932
,
75.616
,
27.747
),
(
11
,
45
,
5
),
(
22
,
90
,
10
))
]
nldir
=
op
.
join
(
datadir
,
'
nonlinear
'
)
src
=
op
.
join
(
nldir
,
'
src.nii.gz
'
)
ref
=
op
.
join
(
nldir
,
'
ref.nii.gz
'
)
cf
=
op
.
join
(
nldir
,
'
coefficientfield.nii.gz
'
)
src
=
fslimage
.
Image
(
src
)
ref2mm
=
fslimage
.
Image
(
ref
)
ref1mm
=
ref2mm
.
adjust
((
1
,
1
,
1
))
cfref2mm
=
fnirt
.
readFnirt
(
cf
,
src
,
ref2mm
)
cfref1mm
=
fnirt
.
readFnirt
(
cf
,
src
,
ref1mm
)
for
srcc
,
ref2mmc
,
ref1mmc
in
coords
:
ref2mmc
=
cfref2mm
.
transform
(
ref2mmc
,
'
voxel
'
,
'
voxel
'
)
ref1mmc
=
cfref1mm
.
transform
(
ref1mmc
,
'
voxel
'
,
'
voxel
'
)
assert
np
.
all
(
np
.
isclose
(
ref2mmc
,
srcc
,
1e-4
))
assert
np
.
all
(
np
.
isclose
(
ref1mmc
,
srcc
,
1e-4
))
def
test_coefficientFieldToDeformationField
():
nldir
=
op
.
join
(
datadir
,
'
nonlinear
'
)
...
...
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