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
7138abc2
Commit
7138abc2
authored
1 year ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
More test coverage of number of channels in multichannel export
parent
efc48f21
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
model_server/extensions/chaeo/products.py
+1
-0
1 addition, 0 deletions
model_server/extensions/chaeo/products.py
model_server/extensions/chaeo/tests/test_zstack.py
+27
-25
27 additions, 25 deletions
model_server/extensions/chaeo/tests/test_zstack.py
with
28 additions
and
25 deletions
model_server/extensions/chaeo/products.py
+
1
−
0
View file @
7138abc2
...
@@ -235,6 +235,7 @@ def export_patches_from_zstack(
...
@@ -235,6 +235,7 @@ def export_patches_from_zstack(
exported
.
append
({
exported
.
append
({
'
df_index
'
:
roi
.
Index
,
'
df_index
'
:
roi
.
Index
,
'
patch_filename
'
:
fname
,
'
patch_filename
'
:
fname
,
'
location
'
:
where
.
__str__
(),
})
})
exported
=
[]
exported
=
[]
...
...
This diff is collapsed.
Click to expand it.
model_server/extensions/chaeo/tests/test_zstack.py
+
27
−
25
View file @
7138abc2
import
unittest
import
unittest
import
numpy
as
np
import
numpy
as
np
from
pathlib
import
Path
from
model_server.conf.testing
import
output_path
from
model_server.conf.testing
import
output_path
...
@@ -131,9 +132,7 @@ class TestZStackDerivedDataProducts(unittest.TestCase):
...
@@ -131,9 +132,7 @@ class TestZStackDerivedDataProducts(unittest.TestCase):
)
)
files
=
export_patches_from_zstack
(
files
=
export_patches_from_zstack
(
output_path
/
'
3d_patches
'
,
output_path
/
'
3d_patches
'
,
# self.stack_ch_pa,
roiset
,
roiset
,
# roiset.zmask_meta,
make_3d
=
True
)
make_3d
=
True
)
self
.
assertGreaterEqual
(
len
(
files
),
1
)
self
.
assertGreaterEqual
(
len
(
files
),
1
)
...
@@ -145,8 +144,6 @@ class TestZStackDerivedDataProducts(unittest.TestCase):
...
@@ -145,8 +144,6 @@ class TestZStackDerivedDataProducts(unittest.TestCase):
from
model_server.extensions.chaeo.zmask
import
project_stack_from_focal_points
from
model_server.extensions.chaeo.zmask
import
project_stack_from_focal_points
# dff = df[df['keeper']]
img
=
project_stack_from_focal_points
(
img
=
project_stack_from_focal_points
(
df
[
'
centroid-0
'
].
to_numpy
(),
df
[
'
centroid-0
'
].
to_numpy
(),
df
[
'
centroid-1
'
].
to_numpy
(),
df
[
'
centroid-1
'
].
to_numpy
(),
...
@@ -168,49 +165,42 @@ class TestZStackDerivedDataProducts(unittest.TestCase):
...
@@ -168,49 +165,42 @@ class TestZStackDerivedDataProducts(unittest.TestCase):
id_map
,
id_map
,
self
.
stack
,
self
.
stack
,
params
=
RoiSetMetaParams
(
params
=
RoiSetMetaParams
(
mask_type
=
mask_type
,
filters
=
kwargs
.
get
(
'
filters
'
)
expand_box_by
=
(
128
,
2
),
mask_type
=
mask_type
,
filters
=
{
'
area
'
:
{
'
min
'
:
1e3
,
'
max
'
:
1e4
}},
)
)
)
)
def
test_make_multichannel_2d_patches_from_zmask
(
self
):
def
test_make_multichannel_2d_patches_from_zmask
(
self
):
roiset
=
self
.
_setup_multichannel_tests
(
roiset
=
self
.
_setup_multichannel_tests
()
filters
=
{
'
area
'
:
{
'
min
'
:
1e3
,
'
max
'
:
1e4
}},
expand_box_by
=
(
128
,
2
)
)
files
=
export_multichannel_patches_from_zstack
(
files
=
export_multichannel_patches_from_zstack
(
output_path
/
'
2d_patches_chlorophyl_bbox_overlay
'
,
output_path
/
'
2d_patches_chlorophyl_bbox_overlay
'
,
# InMemoryDataAccessor(self.stack.data),
# roiset.zmask_meta,
roiset
,
roiset
,
rgb_
white_channel
=
4
,
white_channel
=
4
,
draw_bounding_box
=
True
,
draw_bounding_box
=
True
,
bounding_box_channel
=
1
,
bounding_box_channel
=
1
,
)
)
self
.
assertGreaterEqual
(
len
(
files
),
1
)
self
.
assertGreaterEqual
(
len
(
files
),
1
)
result
=
generate_file_accessor
(
Path
(
files
[
0
][
'
location
'
])
/
files
[
0
][
'
patch_filename
'
])
self
.
assertEqual
(
result
.
chroma
,
1
)
def
test_make_multichannel_2d_patches_with_mask_overlay
(
self
):
def
test_make_multichannel_2d_patches_with_mask_overlay
(
self
):
roiset
=
self
.
test_zmask_makes_correct_boxes
(
roiset
=
self
.
_setup_multichannel_tests
()
filters
=
{
'
area
'
:
{
'
min
'
:
1e3
,
'
max
'
:
1e4
}},
expand_box_by
=
(
128
,
2
)
)
files
=
export_multichannel_patches_from_zstack
(
files
=
export_multichannel_patches_from_zstack
(
output_path
/
'
2d_patches_chlorophyl_mask_overlay
'
,
output_path
/
'
2d_patches_chlorophyl_mask_overlay
'
,
# InMemoryDataAccessor(self.stack.data),
# roiset.zmask_meta,
roiset
,
roiset
,
rgb_
white_channel
=
4
,
white_channel
=
4
,
ch_
rgb_overlay
=
(
3
,
None
,
None
),
#
rgb_overlay
_channels
=(3, None, None),
draw_mask
=
True
,
draw_mask
=
True
,
mask_channel
=
0
,
mask_channel
=
0
,
overlay_
gain
=
(
0.1
,
1.0
,
1.0
)
# rgb_
overlay_
weights
=(0.1, 1.0, 1.0)
)
)
self
.
assertGreaterEqual
(
len
(
files
),
1
)
self
.
assertGreaterEqual
(
len
(
files
),
1
)
result
=
generate_file_accessor
(
Path
(
files
[
0
][
'
location
'
])
/
files
[
0
][
'
patch_filename
'
])
self
.
assertEqual
(
result
.
chroma
,
1
)
def
test_make_multichannel_2d_patches_with_contour_overlay
(
self
):
def
test_make_multichannel_2d_patches_with_contour_overlay
(
self
):
roiset
=
self
.
test_zmask_makes_correct_boxes
(
roiset
=
self
.
_setup_multichannel_tests
()
filters
=
{
'
area
'
:
{
'
min
'
:
1e3
,
'
max
'
:
1e4
}},
expand_box_by
=
(
128
,
2
)
)
files
=
export_multichannel_patches_from_zstack
(
files
=
export_multichannel_patches_from_zstack
(
output_path
/
'
2d_patches_chlorophyl_contour_overlay
'
,
output_path
/
'
2d_patches_chlorophyl_contour_overlay
'
,
# InMemoryDataAccessor(self.stack.data),
# InMemoryDataAccessor(self.stack.data),
...
@@ -222,6 +212,18 @@ class TestZStackDerivedDataProducts(unittest.TestCase):
...
@@ -222,6 +212,18 @@ class TestZStackDerivedDataProducts(unittest.TestCase):
overlay_gain
=
(
0.1
,
1.0
,
1.0
)
overlay_gain
=
(
0.1
,
1.0
,
1.0
)
)
)
self
.
assertGreaterEqual
(
len
(
files
),
1
)
self
.
assertGreaterEqual
(
len
(
files
),
1
)
result
=
generate_file_accessor
(
Path
(
files
[
0
][
'
location
'
])
/
files
[
0
][
'
patch_filename
'
])
self
.
assertEqual
(
result
.
chroma
,
3
)
def
test_make_2d_patches_as_multichannel_tif
(
self
):
roiset
=
self
.
_setup_multichannel_tests
()
files
=
export_multichannel_patches_from_zstack
(
output_path
/
'
2d_patches_chlorophyl_contour_overlay
'
,
roiset
,
)
self
.
assertGreaterEqual
(
len
(
files
),
1
)
result
=
generate_file_accessor
(
Path
(
files
[
0
][
'
location
'
])
/
files
[
0
][
'
patch_filename
'
])
self
.
assertEqual
(
result
.
chroma
,
5
)
# TODO: rewrite with direct call to RoiSet methods
# TODO: rewrite with direct call to RoiSet methods
def
test_make_binary_masks_from_zmask
(
self
):
def
test_make_binary_masks_from_zmask
(
self
):
...
...
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