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
1e8c9315
Commit
1e8c9315
authored
8 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Adjusted image wrapper test to generate slices which are outside
of coverage, but overlap on some dimensions.
parent
e5e0cc96
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
test/test_imagewrapper.py
+18
-1
18 additions, 1 deletion
test/test_imagewrapper.py
with
18 additions
and
1 deletion
test/test_imagewrapper.py
+
18
−
1
View file @
1e8c9315
...
@@ -66,6 +66,17 @@ def random_slices(coverage, shape, mode):
...
@@ -66,6 +66,17 @@ def random_slices(coverage, shape, mode):
slices
=
np
.
zeros
((
2
,
len
(
shape
)))
slices
=
np
.
zeros
((
2
,
len
(
shape
)))
origMode
=
mode
# If we're generating an 'out' slice (i.e.
# a slice which is not covered by the coverage),
# then only one dimension needs to be out. The
# other dimensions don't matter.
if
mode
==
'
out
'
:
dimModes
=
[
random
.
choice
((
'
in
'
,
'
out
'
,
'
overlap
'
))
for
i
in
range
(
ndims
)]
if
not
any
([
m
==
'
out
'
for
m
in
dimModes
]):
dimModes
[
random
.
randint
(
0
,
ndims
-
1
)]
=
'
out
'
for
dim
,
size
in
enumerate
(
shape
):
for
dim
,
size
in
enumerate
(
shape
):
# Volumes
# Volumes
...
@@ -75,13 +86,19 @@ def random_slices(coverage, shape, mode):
...
@@ -75,13 +86,19 @@ def random_slices(coverage, shape, mode):
slices
[:,
dim
]
=
lowCover
,
highCover
slices
[:,
dim
]
=
lowCover
,
highCover
continue
continue
if
origMode
==
'
out
'
:
mode
=
dimModes
[
dim
]
# Assuming that coverage is same for each volume
# Assuming that coverage is same for each volume
lowCover
=
coverage
[
0
,
dim
,
0
]
lowCover
=
coverage
[
0
,
dim
,
0
]
highCover
=
coverage
[
1
,
dim
,
0
]
highCover
=
coverage
[
1
,
dim
,
0
]
if
(
np
.
isnan
(
lowCover
)
or
np
.
isnan
(
highCover
))
and
mode
in
(
'
in
'
,
'
overlap
'
):
if
(
np
.
isnan
(
lowCover
)
or
np
.
isnan
(
highCover
))
and
mode
in
(
'
in
'
,
'
overlap
'
):
raise
RuntimeError
(
'
Can
\'
t generate in/overlapping slices on an empty coverage
'
)
if
origMode
==
'
out
'
:
mode
=
'
out
'
else
:
raise
RuntimeError
(
'
Can
\'
t generate in/overlapping slices on an empty coverage
'
)
# Generate some slices that will
# Generate some slices that will
# be contained within the coverage
# be contained within the coverage
...
...
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