Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Michiel Cottaar
fslpy
Commits
aad9453a
Commit
aad9453a
authored
7 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
unit tests for new MGHImage properties
parent
1b7dee30
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_mghimage.py
+13
-5
13 additions, 5 deletions
tests/test_mghimage.py
with
13 additions
and
5 deletions
tests/test_mghimage.py
+
13
−
5
View file @
aad9453a
...
...
@@ -12,9 +12,10 @@ import shutil
import
numpy
as
np
import
nibabel
as
nib
import
fsl.utils.tempdir
as
tempdir
import
fsl.data.mghimage
as
fslmgh
import
fsl.data.image
as
fslimage
import
fsl.utils.tempdir
as
tempdir
import
fsl.utils.transform
as
transform
import
fsl.data.mghimage
as
fslmgh
import
fsl.data.image
as
fslimage
datadir
=
op
.
join
(
op
.
abspath
(
op
.
dirname
(
__file__
)),
'
testdata
'
)
...
...
@@ -27,9 +28,16 @@ def test_MGHImage():
# Load from a file
img
=
fslmgh
.
MGHImage
(
testfile
)
nbimg
=
nib
.
load
(
testfile
)
v2s
=
nbimg
.
header
.
get_vox2ras_tkr
()
w2s
=
transform
.
concat
(
v2s
,
transform
.
invert
(
nbimg
.
affine
))
assert
np
.
all
(
np
.
isclose
(
img
[:],
nbimg
.
get_data
()))
assert
np
.
all
(
np
.
isclose
(
img
.
voxToWorldMat
,
nbimg
.
affine
))
assert
np
.
all
(
np
.
isclose
(
img
.
voxToSurfMat
,
v2s
))
assert
np
.
all
(
np
.
isclose
(
img
.
surfToVoxMat
,
transform
.
invert
(
v2s
)))
assert
np
.
all
(
np
.
isclose
(
img
.
worldToSurfMat
,
w2s
))
assert
np
.
all
(
np
.
isclose
(
img
.
surfToWorldMat
,
transform
.
invert
(
w2s
)))
assert
np
.
all
(
np
.
isclose
(
img
[:],
nbimg
.
get_data
()))
assert
np
.
all
(
np
.
isclose
(
img
.
voxToWorldMat
,
nbimg
.
affine
))
assert
img
.
name
==
op
.
basename
(
testfile
)
assert
img
.
dataSource
==
testfile
assert
img
.
mghImageFile
==
testfile
...
...
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