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
70216109
Commit
70216109
authored
5 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
TEST: use fixture so we can see seed value. Make test more lenient
parent
da579bd8
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_scripts/test_fsl_apply_x5.py
+23
-16
23 additions, 16 deletions
tests/test_scripts/test_fsl_apply_x5.py
with
23 additions
and
16 deletions
tests/test_scripts/test_fsl_apply_x5.py
+
23
−
16
View file @
70216109
...
@@ -44,7 +44,7 @@ def test_help():
...
@@ -44,7 +44,7 @@ def test_help():
def
test_linear
():
def
test_linear
(
seed
):
with
tempdir
.
tempdir
():
with
tempdir
.
tempdir
():
src2ref
=
_random_affine
()
src2ref
=
_random_affine
()
...
@@ -65,7 +65,7 @@ def test_linear():
...
@@ -65,7 +65,7 @@ def test_linear():
assert
np
.
all
(
np
.
isclose
(
result
.
data
,
expect
))
assert
np
.
all
(
np
.
isclose
(
result
.
data
,
expect
))
def
test_nonlinear
():
def
test_nonlinear
(
seed
):
with
tempdir
.
tempdir
():
with
tempdir
.
tempdir
():
src2ref
=
_random_affine
()
src2ref
=
_random_affine
()
...
@@ -92,7 +92,7 @@ def test_nonlinear():
...
@@ -92,7 +92,7 @@ def test_nonlinear():
assert
np
.
all
(
np
.
isclose
(
result
,
expect
))
assert
np
.
all
(
np
.
isclose
(
result
,
expect
))
def
test_linear_altref
():
def
test_linear_altref
(
seed
):
with
tempdir
.
tempdir
():
with
tempdir
.
tempdir
():
src2ref
=
affine
.
scaleOffsetXform
([
1
,
1
,
1
],
[
5
,
5
,
5
])
src2ref
=
affine
.
scaleOffsetXform
([
1
,
1
,
1
],
[
5
,
5
,
5
])
...
@@ -119,7 +119,7 @@ def test_linear_altref():
...
@@ -119,7 +119,7 @@ def test_linear_altref():
assert
np
.
all
(
result
.
data
==
expect
)
assert
np
.
all
(
result
.
data
==
expect
)
def
test_nonlinear_altref
():
def
test_nonlinear_altref
(
seed
):
with
tempdir
.
tempdir
():
with
tempdir
.
tempdir
():
src2ref
=
affine
.
scaleOffsetXform
([
1
,
1
,
1
],
[
5
,
5
,
5
])
src2ref
=
affine
.
scaleOffsetXform
([
1
,
1
,
1
],
[
5
,
5
,
5
])
...
@@ -149,7 +149,7 @@ def test_nonlinear_altref():
...
@@ -149,7 +149,7 @@ def test_nonlinear_altref():
assert
np
.
all
(
result
.
data
==
expect
)
assert
np
.
all
(
result
.
data
==
expect
)
def
test_linear_altsrc
():
def
test_linear_altsrc
(
seed
):
with
tempdir
.
tempdir
():
with
tempdir
.
tempdir
():
src2ref
=
_random_affine
()
src2ref
=
_random_affine
()
...
@@ -198,7 +198,7 @@ def test_linear_altsrc():
...
@@ -198,7 +198,7 @@ def test_linear_altsrc():
assert
np
.
all
(
np
.
isclose
(
outoff
.
data
,
expoff
))
assert
np
.
all
(
np
.
isclose
(
outoff
.
data
,
expoff
))
def
test_nonlinear_altsrc
():
def
test_nonlinear_altsrc
(
seed
):
with
tempdir
.
tempdir
():
with
tempdir
.
tempdir
():
src2ref
=
_random_affine
()
src2ref
=
_random_affine
()
...
@@ -252,13 +252,20 @@ def test_nonlinear_altsrc():
...
@@ -252,13 +252,20 @@ def test_nonlinear_altsrc():
assert
outhi
.
sameSpace
(
ref
)
assert
outhi
.
sameSpace
(
ref
)
assert
outoff
.
sameSpace
(
ref
)
assert
outoff
.
sameSpace
(
ref
)
# We get boundary issues just at the first
# We get boundary cropping,
# voxel, so I'm masking that voxel out
# so ignore edge slices
for
img
in
(
out
,
outlo
,
outhi
,
outoff
,
out
=
out
.
data
[
1
:
-
1
,
1
:
-
1
,
1
:
-
1
]
exp
,
explo
,
exphi
,
expoff
):
outlo
=
outlo
.
data
[
1
:
-
1
,
1
:
-
1
,
1
:
-
1
]
img
[
0
,
0
,
0
]
=
0
outhi
=
outhi
.
data
[
1
:
-
1
,
1
:
-
1
,
1
:
-
1
]
outoff
=
outoff
.
data
[
1
:
-
1
,
1
:
-
1
,
1
:
-
1
]
assert
np
.
all
(
np
.
isclose
(
out
.
data
,
exp
))
exp
=
exp
[
1
:
-
1
,
1
:
-
1
,
1
:
-
1
]
assert
np
.
all
(
np
.
isclose
(
outlo
.
data
,
explo
))
explo
=
explo
[
1
:
-
1
,
1
:
-
1
,
1
:
-
1
]
assert
np
.
all
(
np
.
isclose
(
outhi
.
data
,
exphi
))
exphi
=
exphi
[
1
:
-
1
,
1
:
-
1
,
1
:
-
1
]
assert
np
.
all
(
np
.
isclose
(
outoff
.
data
,
expoff
))
expoff
=
expoff
[
1
:
-
1
,
1
:
-
1
,
1
:
-
1
]
tol
=
dict
(
atol
=
1e-3
,
rtol
=
1e-3
)
assert
np
.
all
(
np
.
isclose
(
out
,
exp
,
**
tol
))
assert
np
.
all
(
np
.
isclose
(
outlo
,
explo
,
**
tol
))
assert
np
.
all
(
np
.
isclose
(
outhi
,
exphi
,
**
tol
))
assert
np
.
all
(
np
.
isclose
(
outoff
,
expoff
,
**
tol
))
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