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
00eabbe1
Commit
00eabbe1
authored
6 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
TEST: Test for fileOrImage. Fixed parse_data test - depends on FSL
parent
c68da9a3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_parse_data.py
+3
-1
3 additions, 1 deletion
tests/test_parse_data.py
tests/test_wrapperutils.py
+23
-0
23 additions, 0 deletions
tests/test_wrapperutils.py
with
26 additions
and
1 deletion
tests/test_parse_data.py
+
3
−
1
View file @
00eabbe1
...
...
@@ -15,6 +15,7 @@ from fsl.data.atlases import Atlas
from
pytest
import
raises
from
.test_image
import
make_image
import
os
import
pytest
datadir
=
op
.
join
(
op
.
dirname
(
__file__
),
'
testdata
'
)
...
...
@@ -115,6 +116,7 @@ def test_image_out():
assert
args
.
image_out
==
'
test.surf.gii
'
+
extension
@pytest.mark.fsltest
def
test_atlas
():
atlas_parser
=
argparse
.
ArgumentParser
(
'
reads an atlas
'
)
atlas_parser
.
add_argument
(
'
atlas
'
,
type
=
parse_data
.
Atlas
)
...
...
@@ -123,4 +125,4 @@ def test_atlas():
assert
isinstance
(
args
.
atlas
,
Atlas
)
with
raises
(
SystemExit
):
atlas_parser
.
parse_args
([
'
fake
'
])
\ No newline at end of file
atlas_parser
.
parse_args
([
'
fake
'
])
This diff is collapsed.
Click to expand it.
tests/test_wrapperutils.py
+
23
−
0
View file @
00eabbe1
...
...
@@ -21,6 +21,7 @@ import nibabel as nib
import
fsl.utils.tempdir
as
tempdir
import
fsl.utils.run
as
run
import
fsl.utils.fslsub
as
fslsub
import
fsl.data.image
as
fslimage
import
fsl.wrappers.wrapperutils
as
wutils
...
...
@@ -284,6 +285,28 @@ def test_fileOrImage():
assert
np
.
all
(
nib
.
load
(
'
output.nii
'
).
get_data
()
==
expected
)
os
.
remove
(
'
output.nii
'
)
# fslimage, file, load
result
=
func
(
fslimage
.
Image
(
img1
),
img2
=
'
img2.nii
'
,
output
=
wutils
.
LOAD
)[
'
output
'
]
assert
isinstance
(
result
,
fslimage
.
Image
)
assert
np
.
all
(
result
[:].
squeeze
()
==
expected
)
# fslimage, fslimage, load
result
=
func
(
fslimage
.
Image
(
img1
),
img2
=
fslimage
.
Image
(
img2
),
output
=
wutils
.
LOAD
)[
'
output
'
]
assert
isinstance
(
result
,
fslimage
.
Image
)
assert
np
.
all
(
result
[:].
squeeze
()
==
expected
)
# fslimage, nib.image, load
result
=
func
(
fslimage
.
Image
(
img1
),
img2
=
img2
,
output
=
wutils
.
LOAD
)[
'
output
'
]
assert
isinstance
(
result
,
fslimage
.
Image
)
assert
np
.
all
(
result
[:].
squeeze
()
==
expected
)
# nib.image, nib.image, load
result
=
func
(
img1
,
img2
=
img2
,
output
=
wutils
.
LOAD
)[
'
output
'
]
assert
isinstance
(
result
,
nib
.
nifti1
.
Nifti1Image
)
assert
np
.
all
(
result
.
get_data
()[:]
==
expected
)
def
test_chained_fileOrImageAndArray
():
...
...
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