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
5a770788
Commit
5a770788
authored
1 year ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
Completed testing zmask module, including contour and filter optional args
parent
37e678ec
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
extensions/chaeo/test_zstack.py
+9
-5
9 additions, 5 deletions
extensions/chaeo/test_zstack.py
extensions/chaeo/zstack.py
+7
-2
7 additions, 2 deletions
extensions/chaeo/zstack.py
with
16 additions
and
7 deletions
extensions/chaeo/test_zstack.py
+
9
−
5
View file @
5a770788
...
...
@@ -21,16 +21,17 @@ class TestZStackDerivedDataProducts(unittest.TestCase):
mip
=
InMemoryDataAccessor
(
self
.
stack
.
get_one_channel_data
(
channel
=
0
).
data
.
max
(
axis
=-
1
,
keepdims
=
True
))
self
.
pxmap
,
result
=
pxmodel
.
infer
(
mip
)
write_accessor_data_to_file
(
output_path
/
'
pxmap.tif
'
,
self
.
pxmap
)
#
write_accessor_data_to_file(output_path / 'pxmap.tif', self.pxmap)
self
.
obmap
=
InMemoryDataAccessor
(
self
.
pxmap
.
data
>
pipeline_params
[
'
threshold
'
])
write_accessor_data_to_file
(
output_path
/
'
obmap.tif
'
,
self
.
obmap
)
#
write_accessor_data_to_file(output_path / 'obmap.tif', self.obmap)
def
test_zmask_makes_correct_boxes
(
self
):
def
test_zmask_makes_correct_boxes
(
self
,
mask_type
=
'
boxes
'
,
filters
=
None
):
zmask
,
meta
=
build_stack_mask
(
'
test_zmask_with boxes
'
,
self
.
obmap
.
get_one_channel_data
(
0
),
self
.
stack
.
get_one_channel_data
(
0
),
mask_type
=
'
boxes
'
,
mask_type
=
mask_type
,
filters
=
filters
,
)
zmask_acc
=
InMemoryDataAccessor
(
zmask
)
self
.
assertTrue
(
zmask_acc
.
is_mask
())
...
...
@@ -51,4 +52,7 @@ class TestZStackDerivedDataProducts(unittest.TestCase):
self
.
assertGreaterEqual
(
sh
[
0
]
*
sh
[
1
],
ar
)
def
test_zmask_makes_correct_contours
(
self
):
pass
\ No newline at end of file
return
self
.
test_zmask_makes_correct_boxes
(
mask_type
=
'
contours
'
)
def
test_zmask_makes_correct_boxes_with_filters
(
self
):
return
self
.
test_zmask_makes_correct_boxes
(
filters
=
{
'
area
'
:
(
1e3
,
1e4
)})
\ No newline at end of file
This diff is collapsed.
Click to expand it.
extensions/chaeo/zstack.py
+
7
−
2
View file @
5a770788
...
...
@@ -98,8 +98,13 @@ def build_stack_mask(desc, obmap: GenericImageDataAccessor, stack: GenericImageD
zi_st
=
np
.
zeros
(
stack
.
shape
,
dtype
=
'
bool
'
)
if
mask_type
==
'
contours
'
:
zi_map
=
(
lut
[
lamap
]
+
1.0
).
astype
(
'
int
'
)
idxs
=
np
.
array
([
zi_map
])
-
1
np
.
put_along_axis
(
zi_st
,
idxs
,
1
,
axis
=
3
)
idxs
=
np
.
array
(
zi_map
)
-
1
np
.
put_along_axis
(
zi_st
,
np
.
expand_dims
(
idxs
,
(
2
,
3
)),
1
,
axis
=
3
)
# change background level from to 0 in final frame
zi_st
[:,
:,
:,
-
1
][
lamap
==
0
]
=
0
...
...
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