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
fb0fa722
Commit
fb0fa722
authored
6 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
TEST: Do not use indexed argument. Check that indexed_gzip is being used
parent
9330dc81
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_advanced.py
+27
-8
27 additions, 8 deletions
tests/test_image_advanced.py
with
27 additions
and
8 deletions
tests/test_image_advanced.py
+
27
−
8
View file @
fb0fa722
...
@@ -57,7 +57,6 @@ def _test_image_indexed(threaded):
...
@@ -57,7 +57,6 @@ def _test_image_indexed(threaded):
filename
,
filename
,
loadData
=
False
,
loadData
=
False
,
calcRange
=
False
,
calcRange
=
False
,
indexed
=
True
,
threaded
=
threaded
)
threaded
=
threaded
)
# First iteration through the image
# First iteration through the image
...
@@ -72,6 +71,17 @@ def _test_image_indexed(threaded):
...
@@ -72,6 +71,17 @@ def _test_image_indexed(threaded):
assert
img
.
dataRange
==
(
0
,
vol
)
assert
img
.
dataRange
==
(
0
,
vol
)
end1
=
time
.
time
()
end1
=
time
.
time
()
# Double check that indexed_gzip is
# being used (the internal _opener
# attribute is not created until
# after the first data access)
try
:
import
indexed_gzip
as
igzip
assert
isinstance
(
img
.
nibImage
.
dataobj
.
_opener
.
fobj
,
igzip
.
IndexedGzipFile
)
except
ImportError
:
pass
# Second iteration through
# Second iteration through
start2
=
time
.
time
()
start2
=
time
.
time
()
for
vol
in
range
(
data
.
shape
[
-
1
]):
for
vol
in
range
(
data
.
shape
[
-
1
]):
...
@@ -108,7 +118,6 @@ def _test_image_indexed_read4D(threaded):
...
@@ -108,7 +118,6 @@ def _test_image_indexed_read4D(threaded):
filename
,
filename
,
loadData
=
False
,
loadData
=
False
,
calcRange
=
False
,
calcRange
=
False
,
indexed
=
True
,
threaded
=
threaded
)
threaded
=
threaded
)
# Test reading slice through
# Test reading slice through
...
@@ -126,6 +135,14 @@ def _test_image_indexed_read4D(threaded):
...
@@ -126,6 +135,14 @@ def _test_image_indexed_read4D(threaded):
assert
np
.
all
(
data
==
np
.
arange
(
nvols
))
assert
np
.
all
(
data
==
np
.
arange
(
nvols
))
# double check we're indexing as expected
try
:
import
indexed_gzip
as
igzip
assert
isinstance
(
img
.
nibImage
.
dataobj
.
_opener
.
fobj
,
igzip
.
IndexedGzipFile
)
except
ImportError
:
pass
@pytest.mark.igziptest
@pytest.mark.igziptest
@pytest.mark.longtest
@pytest.mark.longtest
...
@@ -150,13 +167,20 @@ def _test_image_indexed_save(threaded):
...
@@ -150,13 +167,20 @@ def _test_image_indexed_save(threaded):
filename
,
filename
,
loadData
=
False
,
loadData
=
False
,
calcRange
=
False
,
calcRange
=
False
,
indexed
=
True
,
threaded
=
threaded
)
threaded
=
threaded
)
# access some data
# access some data
img
[...,
0
]
img
[...,
0
]
img
[...,
40
]
img
[...,
40
]
# double check that igzip is being used
try
:
import
indexed_gzip
as
igzip
assert
isinstance
(
img
.
nibImage
.
dataobj
.
_opener
.
fobj
,
igzip
.
IndexedGzipFile
)
except
ImportError
:
pass
if
threaded
:
if
threaded
:
img
.
getImageWrapper
().
getTaskThread
().
waitUntilIdle
()
img
.
getImageWrapper
().
getTaskThread
().
waitUntilIdle
()
...
@@ -203,10 +227,8 @@ def _test_image_indexed_save(threaded):
...
@@ -203,10 +227,8 @@ def _test_image_indexed_save(threaded):
@pytest.mark.longtest
@pytest.mark.longtest
@pytest.mark.igziptest
def
test_image_no_calcRange_threaded
():
_test_image_no_calcRange
(
True
)
def
test_image_no_calcRange_threaded
():
_test_image_no_calcRange
(
True
)
@pytest.mark.longtest
@pytest.mark.longtest
@pytest.mark.igziptest
def
test_image_no_calcRange_unthreaded
():
_test_image_no_calcRange
(
False
)
def
test_image_no_calcRange_unthreaded
():
_test_image_no_calcRange
(
False
)
def
_test_image_no_calcRange
(
threaded
):
def
_test_image_no_calcRange
(
threaded
):
...
@@ -228,7 +250,6 @@ def _test_image_no_calcRange(threaded):
...
@@ -228,7 +250,6 @@ def _test_image_no_calcRange(threaded):
# cal_min/max if it is unknown
# cal_min/max if it is unknown
assert
img
.
dataRange
==
(
95
,
643
)
assert
img
.
dataRange
==
(
95
,
643
)
for
i
in
[
0
,
7
,
40
]:
for
i
in
[
0
,
7
,
40
]:
img
[...,
i
]
img
[...,
i
]
if
threaded
:
if
threaded
:
...
@@ -238,10 +259,8 @@ def _test_image_no_calcRange(threaded):
...
@@ -238,10 +259,8 @@ def _test_image_no_calcRange(threaded):
@pytest.mark.longtest
@pytest.mark.longtest
@pytest.mark.igziptest
def
test_image_calcRange_threaded
():
_test_image_calcRange
(
True
)
def
test_image_calcRange_threaded
():
_test_image_calcRange
(
True
)
@pytest.mark.longtest
@pytest.mark.longtest
@pytest.mark.igziptest
def
test_image_calcRange_unthreaded
():
_test_image_calcRange
(
False
)
def
test_image_calcRange_unthreaded
():
_test_image_calcRange
(
False
)
def
_test_image_calcRange
(
threaded
):
def
_test_image_calcRange
(
threaded
):
...
...
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