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
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Evan Edmond
fslpy
Commits
f57b0a92
Commit
f57b0a92
authored
5 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
TEST: Test identifyAffine
parent
b5a7e362
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_image.py
+23
-0
23 additions, 0 deletions
tests/test_image.py
with
23 additions
and
0 deletions
tests/test_image.py
+
23
−
0
View file @
f57b0a92
...
...
@@ -1342,3 +1342,26 @@ def test_generateAffines():
assert
np
.
all
(
np
.
isclose
(
f2v
,
got
[
'
fsl
'
,
'
voxel
'
]))
assert
np
.
all
(
np
.
isclose
(
f2w
,
got
[
'
fsl
'
,
'
world
'
]))
assert
np
.
all
(
np
.
isclose
(
w2f
,
got
[
'
world
'
,
'
fsl
'
]))
def
test_identifyAffine
():
identify
=
fslimage
.
Nifti
.
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
))
img
=
fslimage
.
Image
(
make_random_image
(
None
,
xform
=
xform
))
for
from_
,
to
in
it
.
permutations
((
'
voxel
'
,
'
fsl
'
,
'
world
'
),
2
):
assert
identify
(
img
,
img
.
getAffine
(
from_
,
to
))
==
(
from_
,
to
)
assert
identify
(
img
,
img
.
getAffine
(
'
voxel
'
,
'
world
'
),
from_
=
'
voxel
'
)
==
(
'
voxel
'
,
'
world
'
)
assert
identify
(
img
,
img
.
getAffine
(
'
voxel
'
,
'
world
'
),
to
=
'
world
'
)
==
(
'
voxel
'
,
'
world
'
)
rubbish
=
np
.
random
.
random
((
4
,
4
))
with
pytest
.
raises
(
ValueError
):
identify
(
img
,
rubbish
)
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