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
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
No related tags found
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):
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
):
# Volumes
...
...
@@ -75,13 +86,19 @@ def random_slices(coverage, shape, mode):
slices
[:,
dim
]
=
lowCover
,
highCover
continue
if
origMode
==
'
out
'
:
mode
=
dimModes
[
dim
]
# Assuming that coverage is same for each volume
lowCover
=
coverage
[
0
,
dim
,
0
]
highCover
=
coverage
[
1
,
dim
,
0
]
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
# 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