Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FSL
fslpy
Commits
a71c8d0e
Commit
a71c8d0e
authored
Jul 14, 2017
by
Paul McCarthy
🚵
Browse files
Merge branch 'master' into v1.0
parents
bb52dcd1
0478c7c2
Pipeline
#777
canceled with stages
in 14 minutes and 18 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
tests/test_callfsl.py
View file @
a71c8d0e
...
...
@@ -31,10 +31,10 @@ def setup_module():
# or 'fslinfo ...'
def
mock_check_output
(
args
):
if
args
[
0
].
endswith
(
'fslinfo'
):
return
'info'
return
'info'
.
encode
(
'utf-8'
)
img
=
nib
.
load
(
args
[
-
2
])
return
str
(
img
.
get_data
().
mean
())
return
str
(
img
.
get_data
().
mean
())
.
encode
(
'utf-8'
)
def
test_callfsl
():
...
...
tests/test_transform.py
View file @
a71c8d0e
...
...
@@ -108,9 +108,11 @@ def test_scaleOffsetXform():
expected
=
[[
float
(
v
)
for
v
in
l
.
split
()]
for
l
in
expected
]
expected
=
np
.
array
(
expected
)
result
=
transform
.
scaleOffsetXform
(
scales
,
offsets
)
result1
=
transform
.
scaleOffsetXform
(
scales
,
offsets
)
result2
=
transform
.
scaleOffsetXform
(
tuple
(
scales
),
tuple
(
offsets
))
assert
np
.
all
(
np
.
isclose
(
result
,
expected
))
assert
np
.
all
(
np
.
isclose
(
result1
,
expected
))
assert
np
.
all
(
np
.
isclose
(
result2
,
expected
))
def
test_compose_and_decompose
():
...
...
@@ -138,6 +140,19 @@ def test_compose_and_decompose():
assert
np
.
all
(
np
.
isclose
(
xform
,
result
,
atol
=
1e-5
))
# compose should also accept a rotation matrix
rots
=
[
np
.
pi
/
5
,
np
.
pi
/
4
,
np
.
pi
/
3
]
rmat
=
transform
.
axisAnglesToRotMat
(
*
rots
)
xform
=
transform
.
compose
([
1
,
1
,
1
],
[
0
,
0
,
0
],
rmat
)
sc
,
of
,
rot
=
transform
.
decompose
(
xform
)
sc
=
np
.
array
(
sc
)
of
=
np
.
array
(
of
)
rot
=
np
.
array
(
rot
)
assert
np
.
all
(
sc
==
[
1
,
1
,
1
])
assert
np
.
all
(
of
==
[
0
,
0
,
0
])
assert
np
.
all
(
np
.
isclose
(
rot
,
rots
))
def
test_axisBounds
():
testfile
=
op
.
join
(
datadir
,
'test_transform_test_axisBounds.txt'
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment