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
0ceeb9ba
Commit
0ceeb9ba
authored
4 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
TEST: test default image object+file type
parent
f2ce0ed9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_image.py
+32
-2
32 additions, 2 deletions
tests/test_image.py
with
32 additions
and
2 deletions
tests/test_image.py
+
32
−
2
View file @
0ceeb9ba
...
...
@@ -499,8 +499,9 @@ def test_splitExt():
def
test_defaultExt
():
fslOutputTypes
=
[
'
NIFTI
'
,
'
NIFTI_PAIR
'
,
'
NIFTI_GZ
'
]
exts
=
[
'
.nii
'
,
'
.img
'
,
'
.nii.gz
'
]
fslOutputTypes
=
[
'
NIFTI
'
,
'
NIFTI_PAIR
'
,
'
NIFTI_GZ
'
,
'
NIFTI_PAIR_GZ
'
,
'
NIFTI2
'
,
'
NIFTI2_PAIR
'
,
'
NIFTI2_GZ
'
,
'
NIFTI2_PAIR_GZ
'
]
exts
=
[
'
.nii
'
,
'
.img
'
,
'
.nii.gz
'
,
'
.img.gz
'
]
*
2
os
.
environ
.
pop
(
'
FSLOUTPUTTYPE
'
,
None
)
assert
fslimage
.
defaultExt
()
==
'
.nii.gz
'
...
...
@@ -512,6 +513,35 @@ def test_defaultExt():
assert
fslimage
.
defaultExt
()
==
e
def
test_defaultImageType
():
fslOutputTypes
=
[
None
,
'
NIFTI
'
,
'
NIFTI_PAIR
'
,
'
NIFTI_GZ
'
,
'
NIFTI_PAIR_GZ
'
,
'
NIFTI2
'
,
'
NIFTI2_PAIR
'
,
'
NIFTI2_GZ
'
,
'
NIFTI2_PAIR_GZ
'
]
exts
=
[
'
.nii.gz
'
]
+
\
[
'
.nii
'
,
'
.img
'
,
'
.nii.gz
'
,
'
.img.gz
'
]
*
2
with
tempdir
():
for
o
,
e
in
zip
(
fslOutputTypes
,
exts
):
if
o
is
None
:
os
.
environ
.
pop
(
'
FSLOUTPUTTYPE
'
,
None
)
else
:
os
.
environ
[
'
FSLOUTPUTTYPE
'
]
=
o
if
o
is
None
or
'
NIFTI2
'
not
in
o
:
exptype
=
nib
.
Nifti1Image
else
:
exptype
=
nib
.
Nifti2Image
img
=
fslimage
.
Image
(
np
.
random
.
randint
(
1
,
10
,
(
30
,
30
,
30
)))
assert
type
(
img
.
nibImage
)
==
exptype
img
.
save
(
'
image
'
)
assert
op
.
exists
(
'
image
'
+
e
)
def
test_fixExt
():
with
tempdir
():
...
...
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