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
b95875cb
Commit
b95875cb
authored
7 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Unit tests for Image(indexed=True) without indexed_gzip installed
parent
6f36630f
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_advanced.py
+16
-1
16 additions, 1 deletion
tests/test_image_advanced.py
with
16 additions
and
1 deletion
tests/test_image_advanced.py
+
16
−
1
View file @
b95875cb
...
@@ -8,6 +8,8 @@
...
@@ -8,6 +8,8 @@
import
os.path
as
op
import
os.path
as
op
import
time
import
time
import
mock
import
numpy
as
np
import
numpy
as
np
import
nibabel
as
nib
import
nibabel
as
nib
...
@@ -15,6 +17,19 @@ import tests
...
@@ -15,6 +17,19 @@ import tests
import
fsl.data.image
as
fslimage
import
fsl.data.image
as
fslimage
from
.
import
make_random_image
# make sure Image(indexed=True) works
# even if indexed_gzip is not present
def
test_image_indexed_no_igzip_threaded
():
with
mock
.
patch
.
dict
(
'
sys.modules
'
,
indexed_gzip
=
None
):
_test_image_indexed
(
True
)
def
test_image_indexed_no_igzip_unthreaded
():
with
mock
.
patch
.
dict
(
'
sys.modules
'
,
indexed_gzip
=
None
):
_test_image_indexed
(
False
)
def
test_image_indexed_threaded
(
):
_test_image_indexed
(
True
)
def
test_image_indexed_threaded
(
):
_test_image_indexed
(
True
)
def
test_image_indexed_unthreaded
():
_test_image_indexed
(
False
)
def
test_image_indexed_unthreaded
():
_test_image_indexed
(
False
)
def
_test_image_indexed
(
threaded
):
def
_test_image_indexed
(
threaded
):
...
@@ -24,7 +39,7 @@ def _test_image_indexed(threaded):
...
@@ -24,7 +39,7 @@ def _test_image_indexed(threaded):
filename
=
op
.
join
(
testdir
,
'
image.nii.gz
'
)
filename
=
op
.
join
(
testdir
,
'
image.nii.gz
'
)
# Data range grows with volume
# Data range grows with volume
data
=
np
.
zeros
((
10
0
,
10
0
,
10
0
,
50
))
data
=
np
.
zeros
((
5
0
,
5
0
,
5
0
,
50
))
for
vol
in
range
(
data
.
shape
[
-
1
]):
for
vol
in
range
(
data
.
shape
[
-
1
]):
data
[...,
vol
]
=
vol
data
[...,
vol
]
=
vol
...
...
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