Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
model_server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
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
Christopher Randolph Rhodes
model_server
Commits
ddbbe826
Commit
ddbbe826
authored
11 months ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
Rolled back changes to how masks and slices are handled, but kept updated tests
parent
e70bab43
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!18
Completed (de)serialization of RoiSet
,
!16
Completed (de)serialization of RoiSet
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_roiset.py
+18
-5
18 additions, 5 deletions
tests/test_roiset.py
with
18 additions
and
5 deletions
tests/test_roiset.py
+
18
−
5
View file @
ddbbe826
...
@@ -38,6 +38,16 @@ class TestRoiSetMonoProducts(BaseTestRoiSetMonoProducts, unittest.TestCase):
...
@@ -38,6 +38,16 @@ class TestRoiSetMonoProducts(BaseTestRoiSetMonoProducts, unittest.TestCase):
def
test_roi_mask_shape
(
self
,
**
kwargs
):
def
test_roi_mask_shape
(
self
,
**
kwargs
):
roiset
=
self
.
_make_roi_set
(
**
kwargs
)
roiset
=
self
.
_make_roi_set
(
**
kwargs
)
# all masks' bounding boxes are at least as big as ROI area
for
roi
in
roiset
.
get_df
().
itertuples
():
self
.
assertEqual
(
roi
.
mask
.
dtype
,
'
bool
'
)
sh
=
roi
.
mask
.
shape
self
.
assertEqual
(
sh
,
(
roi
.
y1
-
roi
.
y0
,
roi
.
x1
-
roi
.
x0
))
self
.
assertGreaterEqual
(
sh
[
0
]
*
sh
[
1
],
roi
.
area
)
def
test_roi_zmask
(
self
,
**
kwargs
):
roiset
=
self
.
_make_roi_set
(
**
kwargs
)
zmask
=
roiset
.
get_zmask
()
zmask
=
roiset
.
get_zmask
()
zmask_acc
=
InMemoryDataAccessor
(
zmask
)
zmask_acc
=
InMemoryDataAccessor
(
zmask
)
self
.
assertTrue
(
zmask_acc
.
is_mask
())
self
.
assertTrue
(
zmask_acc
.
is_mask
())
...
@@ -51,11 +61,6 @@ class TestRoiSetMonoProducts(BaseTestRoiSetMonoProducts, unittest.TestCase):
...
@@ -51,11 +61,6 @@ class TestRoiSetMonoProducts(BaseTestRoiSetMonoProducts, unittest.TestCase):
self
.
assertTrue
(
np
.
any
(
zmask
))
self
.
assertTrue
(
np
.
any
(
zmask
))
self
.
assertFalse
(
np
.
all
(
zmask
))
self
.
assertFalse
(
np
.
all
(
zmask
))
# assert non-trivial meta info in boxes
self
.
assertGreater
(
roiset
.
count
,
1
)
sh
=
roiset
.
get_df
().
iloc
[
1
][
'
mask
'
].
shape
ar
=
roiset
.
get_df
().
iloc
[
1
][
'
area
'
]
self
.
assertGreaterEqual
(
sh
[
0
]
*
sh
[
1
],
ar
)
def
test_roiset_from_non_zstacks
(
self
,
**
kwargs
):
def
test_roiset_from_non_zstacks
(
self
,
**
kwargs
):
acc_zstack_slice
=
InMemoryDataAccessor
(
self
.
stack_ch_pa
.
data
[:,
:,
:,
0
])
acc_zstack_slice
=
InMemoryDataAccessor
(
self
.
stack_ch_pa
.
data
[:,
:,
:,
0
])
...
@@ -75,6 +80,13 @@ class TestRoiSetMonoProducts(BaseTestRoiSetMonoProducts, unittest.TestCase):
...
@@ -75,6 +80,13 @@ class TestRoiSetMonoProducts(BaseTestRoiSetMonoProducts, unittest.TestCase):
self
.
assertEqual
(
len
(
ebb
.
shape
),
4
)
self
.
assertEqual
(
len
(
ebb
.
shape
),
4
)
self
.
assertTrue
(
np
.
all
([
si
>=
1
for
si
in
ebb
.
shape
]))
self
.
assertTrue
(
np
.
all
([
si
>=
1
for
si
in
ebb
.
shape
]))
def
test_dataframe_and_mask_array_in_iterator
(
self
):
roiset
=
self
.
_make_roi_set
()
for
roi
in
roiset
:
ma
=
roi
.
mask
self
.
assertEqual
(
ma
.
dtype
,
'
bool
'
)
self
.
assertEqual
(
ma
.
shape
,
(
roi
.
y1
-
roi
.
y0
,
roi
.
x1
-
roi
.
x0
))
def
test_rel_slices_are_valid
(
self
):
def
test_rel_slices_are_valid
(
self
):
roiset
=
self
.
_make_roi_set
()
roiset
=
self
.
_make_roi_set
()
for
roi
in
roiset
:
for
roi
in
roiset
:
...
@@ -85,6 +97,7 @@ class TestRoiSetMonoProducts(BaseTestRoiSetMonoProducts, unittest.TestCase):
...
@@ -85,6 +97,7 @@ class TestRoiSetMonoProducts(BaseTestRoiSetMonoProducts, unittest.TestCase):
self
.
assertEqual
(
len
(
rbb
.
shape
),
4
)
self
.
assertEqual
(
len
(
rbb
.
shape
),
4
)
self
.
assertTrue
(
np
.
all
([
si
>=
1
for
si
in
rbb
.
shape
]))
self
.
assertTrue
(
np
.
all
([
si
>=
1
for
si
in
rbb
.
shape
]))
def
test_make_2d_patches
(
self
):
def
test_make_2d_patches
(
self
):
roiset
=
self
.
_make_roi_set
()
roiset
=
self
.
_make_roi_set
()
files
=
roiset
.
export_patches
(
files
=
roiset
.
export_patches
(
...
...
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