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
f79fc13d
Commit
f79fc13d
authored
2 months ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
TEST: Adjust identifyAffine test
parent
54650e88
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
fsl/tests/test_image.py
+19
-5
19 additions, 5 deletions
fsl/tests/test_image.py
with
19 additions
and
5 deletions
fsl/tests/test_image.py
+
19
−
5
View file @
f79fc13d
...
...
@@ -1471,14 +1471,28 @@ def test_identifyAffine():
assert
identify
(
None
,
None
,
'
ho
'
,
'
hum
'
)
==
(
'
ho
'
,
'
hum
'
)
xform
=
affine
.
compose
(
0.1
+
5
*
np
.
random
.
random
(
3
),
-
10
+
20
*
np
.
random
.
random
(
3
),
-
np
.
pi
/
2
+
np
.
pi
*
np
.
random
.
random
(
3
))
# Construct an affine which causes
# all coordinate systems to be different
xform
=
np
.
diag
([
-
1
,
1
,
1
,
1
])
while
npla
.
det
(
xform
)
<=
0
:
scales
=
0.1
+
5
*
np
.
random
.
random
(
3
)
offsets
=
-
10
+
20
*
np
.
random
.
random
(
3
)
rotations
=
-
np
.
pi
/
2
+
np
.
pi
*
np
.
random
.
random
(
3
)
xform
=
affine
.
compose
(
scales
,
offsets
,
rotations
)
img
=
fslimage
.
Image
(
make_random_image
(
None
,
xform
=
xform
))
img
=
fslimage
.
Image
(
make_random_image
(
None
,
pixdims
=
scales
,
xform
=
xform
))
for
from_
,
to
in
it
.
permutations
((
'
voxel
'
,
'
scaled
'
,
'
fsl
'
,
'
world
'
),
2
):
assert
identify
(
img
,
img
.
getAffine
(
from_
,
to
))
==
(
from_
,
to
)
aff
=
img
.
getAffine
(
from_
,
to
)
got
=
identify
(
img
,
aff
)
# The fsl->scaled and scaled->fsl affines are
# equivalent, as they just encode an inversion
# along the first axis.
if
sorted
((
from_
,
to
))
==
[
'
fsl
'
,
'
scaled
'
]:
assert
got
in
((
from_
,
to
),
(
to
,
from_
))
else
:
assert
got
==
(
from_
,
to
)
assert
identify
(
img
,
img
.
getAffine
(
'
voxel
'
,
'
world
'
),
from_
=
'
voxel
'
)
==
(
'
voxel
'
,
'
world
'
)
assert
identify
(
img
,
img
.
getAffine
(
'
voxel
'
,
'
world
'
),
to
=
'
world
'
)
==
(
'
voxel
'
,
'
world
'
)
...
...
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