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
0ea7a118
Commit
0ea7a118
authored
1 year ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
cleanup
parent
f9a04f7d
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/tests/test_zstack.py
+10
-17
10 additions, 17 deletions
model_server/extensions/chaeo/tests/test_zstack.py
model_server/extensions/chaeo/zmask.py
+1
-4
1 addition, 4 deletions
model_server/extensions/chaeo/zmask.py
with
11 additions
and
21 deletions
model_server/extensions/chaeo/tests/test_zstack.py
+
10
−
17
View file @
0ea7a118
...
@@ -75,7 +75,7 @@ class TestRoiSetMonoProducts(BaseTestRoiSetMonoProducts, unittest.TestCase):
...
@@ -75,7 +75,7 @@ class TestRoiSetMonoProducts(BaseTestRoiSetMonoProducts, unittest.TestCase):
ar
=
roiset
.
get_df
().
iloc
[
1
][
'
area
'
]
ar
=
roiset
.
get_df
().
iloc
[
1
][
'
area
'
]
self
.
assertGreaterEqual
(
sh
[
0
]
*
sh
[
1
],
ar
)
self
.
assertGreaterEqual
(
sh
[
0
]
*
sh
[
1
],
ar
)
def
test_
zmask_works_on
_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
])
self
.
assertEqual
(
acc_zstack_slice
.
nz
,
1
)
self
.
assertEqual
(
acc_zstack_slice
.
nz
,
1
)
id_map
=
get_label_ids
(
self
.
seg_mask
)
id_map
=
get_label_ids
(
self
.
seg_mask
)
...
@@ -86,23 +86,14 @@ class TestRoiSetMonoProducts(BaseTestRoiSetMonoProducts, unittest.TestCase):
...
@@ -86,23 +86,14 @@ class TestRoiSetMonoProducts(BaseTestRoiSetMonoProducts, unittest.TestCase):
zmask_acc
=
InMemoryDataAccessor
(
zmask
)
zmask_acc
=
InMemoryDataAccessor
(
zmask
)
self
.
assertTrue
(
zmask_acc
.
is_mask
())
self
.
assertTrue
(
zmask_acc
.
is_mask
())
def
test_zmask_makes_correct_contours
(
self
):
def
test_slices_are_valid
(
self
):
return
self
.
_make_roi_set
(
mask_type
=
'
contours
'
)
def
test_zmask_makes_correct_boxes_with_filters
(
self
):
return
self
.
_make_roi_set
()
def
test_zmask_makes_correct_expanded_boxes
(
self
):
return
self
.
_make_roi_set
()
def
test_zmask_slices_are_valid
(
self
):
roiset
=
self
.
_make_roi_set
()
roiset
=
self
.
_make_roi_set
()
for
s
in
roiset
.
get_slices
():
for
s
in
roiset
.
get_slices
():
ebb
=
roiset
.
acc_raw
.
data
[
s
]
ebb
=
roiset
.
acc_raw
.
data
[
s
]
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_
zmask_
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
:
ebb
=
roiset
.
acc_raw
.
data
[
roi
.
slice
]
ebb
=
roiset
.
acc_raw
.
data
[
roi
.
slice
]
...
@@ -112,7 +103,7 @@ class TestRoiSetMonoProducts(BaseTestRoiSetMonoProducts, unittest.TestCase):
...
@@ -112,7 +103,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
_from_zmask
(
self
):
def
test_make_2d_patches
(
self
):
roiset
=
self
.
_make_roi_set
()
roiset
=
self
.
_make_roi_set
()
files
=
export_patches_from_zstack
(
files
=
export_patches_from_zstack
(
output_path
/
'
2d_patches
'
,
output_path
/
'
2d_patches
'
,
...
@@ -121,7 +112,7 @@ class TestRoiSetMonoProducts(BaseTestRoiSetMonoProducts, unittest.TestCase):
...
@@ -121,7 +112,7 @@ class TestRoiSetMonoProducts(BaseTestRoiSetMonoProducts, unittest.TestCase):
)
)
self
.
assertGreaterEqual
(
len
(
files
),
1
)
self
.
assertGreaterEqual
(
len
(
files
),
1
)
def
test_make_3d_patches
_from_zmask
(
self
):
def
test_make_3d_patches
(
self
):
roiset
=
self
.
_make_roi_set
()
roiset
=
self
.
_make_roi_set
()
files
=
export_patches_from_zstack
(
files
=
export_patches_from_zstack
(
output_path
/
'
3d_patches
'
,
output_path
/
'
3d_patches
'
,
...
@@ -160,7 +151,7 @@ class TestRoiSetMonoProducts(BaseTestRoiSetMonoProducts, unittest.TestCase):
...
@@ -160,7 +151,7 @@ class TestRoiSetMonoProducts(BaseTestRoiSetMonoProducts, unittest.TestCase):
InMemoryDataAccessor
(
img
)
InMemoryDataAccessor
(
img
)
)
)
def
test_make_binary_masks
_from_zmask
(
self
):
def
test_make_binary_masks
(
self
):
roiset
=
self
.
_make_roi_set
()
roiset
=
self
.
_make_roi_set
()
files
=
roiset
.
export_patch_masks
(
output_path
/
'
2d_mask_patches
'
,
)
files
=
roiset
.
export_patch_masks
(
output_path
/
'
2d_mask_patches
'
,
)
self
.
assertGreaterEqual
(
len
(
files
),
1
)
self
.
assertGreaterEqual
(
len
(
files
),
1
)
...
@@ -303,9 +294,11 @@ class TestRoiSetMultichannelProducts(BaseTestRoiSetMonoProducts, unittest.TestCa
...
@@ -303,9 +294,11 @@ class TestRoiSetMultichannelProducts(BaseTestRoiSetMonoProducts, unittest.TestCa
self
.
assertEqual
(
result
.
chroma
,
5
)
self
.
assertEqual
(
result
.
chroma
,
5
)
def
test_multichannel_annotated_zstack
(
self
):
def
test_multichannel_annotated_zstack
(
self
):
self
.
roiset
.
export_annotated_zstack
(
file
=
self
.
roiset
.
export_annotated_zstack
(
output_path
/
'
multichannel
'
/
'
annotated_zstack
'
,
output_path
/
'
multichannel
'
/
'
annotated_zstack
'
,
'
test_multichannel_annotated_zstack
'
,
'
test_multichannel_annotated_zstack
'
,
)
)
result
=
generate_file_accessor
(
Path
(
file
[
'
location
'
])
/
file
[
'
filename
'
])
self
.
assertEqual
(
result
.
chroma
,
self
.
stack
.
chroma
)
self
.
assertEqual
(
result
.
nz
,
self
.
stack
.
nz
)
This diff is collapsed.
Click to expand it.
model_server/extensions/chaeo/zmask.py
+
1
−
4
View file @
0ea7a118
from
uuid
import
uuid4
from
uuid
import
uuid4
from
math
import
floor
import
numpy
as
np
import
numpy
as
np
import
pandas
as
pd
import
pandas
as
pd
from
pathlib
import
Path
from
skimage.measure
import
find_contours
,
label
,
regionprops_table
from
skimage.measure
import
label
,
regionprops_table
from
sklearn.preprocessing
import
PolynomialFeatures
from
sklearn.preprocessing
import
PolynomialFeatures
from
sklearn.linear_model
import
LinearRegression
from
sklearn.linear_model
import
LinearRegression
from
model_server.base.accessors
import
GenericImageDataAccessor
,
InMemoryDataAccessor
,
write_accessor_data_to_file
from
model_server.base.accessors
import
GenericImageDataAccessor
,
InMemoryDataAccessor
,
write_accessor_data_to_file
from
model_server.base.models
import
InstanceSegmentationModel
from
model_server.base.models
import
InstanceSegmentationModel
from
model_server.base.process
import
pad
,
rescale
,
resample_to_8bit
from
model_server.extensions.chaeo.annotators
import
draw_boxes_on_3d_image
from
model_server.extensions.chaeo.annotators
import
draw_boxes_on_3d_image
from
model_server.extensions.chaeo.products
import
export_patches_from_zstack
from
model_server.extensions.chaeo.products
import
export_patches_from_zstack
...
...
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