Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SVLT
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
ALMF
SVLT
Commits
5df3f720
Commit
5df3f720
authored
4 months ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
Filter objects before generating their binary masks
parent
c038f5b1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
model_server/base/roiset.py
+10
-10
10 additions, 10 deletions
model_server/base/roiset.py
with
10 additions
and
10 deletions
model_server/base/roiset.py
+
10
−
10
View file @
5df3f720
...
...
@@ -212,7 +212,7 @@ def filter_df_overlap_seg(df1: pd.DataFrame, df2: pd.DataFrame = None) -> pd.Dat
return
dfbb
def
make_df_from_object_ids
(
acc_raw
,
acc_obj_ids
,
expand_box_by
,
deproject_channel
=
None
)
->
pd
.
DataFrame
:
def
make_df_from_object_ids
(
acc_raw
,
acc_obj_ids
,
expand_box_by
,
deproject_channel
=
None
,
filters
=
None
)
->
pd
.
DataFrame
:
"""
Build dataframe that associate object IDs with summary stats;
:param acc_raw: accessor to raw image data
...
...
@@ -258,17 +258,19 @@ def make_df_from_object_ids(acc_raw, acc_obj_ids, expand_box_by, deproject_chann
df
=
df_insert_slices
(
df
,
acc_raw
.
shape_dict
,
expand_box_by
)
df_fil
=
filter_df
(
df
,
filters
)
def
_make_binary_mask
(
r
):
acc
=
InMemoryDataAccessor
(
acc_obj_ids
.
data
==
r
.
label
)
cropped
=
acc
.
get_mono
(
0
,
mip
=
True
).
crop_hw
((
r
.
y0
,
r
.
x0
,
(
r
.
y1
-
r
.
y0
),
(
r
.
x1
-
r
.
x0
))).
data_yx
return
cropped
df
[
'
binary_mask
'
]
=
df
.
apply
(
df
_fil
[
'
binary_mask
'
]
=
df
_fil
.
apply
(
_make_binary_mask
,
axis
=
1
,
result_type
=
'
reduce
'
,
)
return
df
return
df
_fil
def
df_insert_slices
(
df
:
pd
.
DataFrame
,
sd
:
dict
,
expand_box_by
)
->
pd
.
DataFrame
:
...
...
@@ -387,13 +389,11 @@ class RoiSet(object):
"""
assert
acc_obj_ids
.
chroma
==
1
df
=
filter_df
(
make_df_from_object_ids
(
acc_raw
,
acc_obj_ids
,
expand_box_by
=
params
.
expand_box_by
,
deproject_channel
=
params
.
deproject_channel
,
),
params
.
filters
,
df
=
make_df_from_object_ids
(
acc_raw
,
acc_obj_ids
,
expand_box_by
=
params
.
expand_box_by
,
deproject_channel
=
params
.
deproject_channel
,
filters
=
params
.
filters
,
)
return
cls
(
acc_raw
,
df
,
params
)
...
...
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