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
f686512c
Commit
f686512c
authored
1 year ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
Separate method to mask out all but largest object
parent
c02b572a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
extensions/chaeo/workflows.py
+4
-10
4 additions, 10 deletions
extensions/chaeo/workflows.py
with
4 additions
and
10 deletions
extensions/chaeo/workflows.py
+
4
−
10
View file @
f686512c
...
...
@@ -11,6 +11,7 @@ from sklearn.model_selection import train_test_split
from
extensions.chaeo.accessors
import
MonoPatchStack
from
extensions.chaeo.annotators
import
draw_boxes_on_3d_image
from
extensions.chaeo.models
import
PatchStackObjectClassifier
from
extensions.chaeo.process
import
mask_largest_object
from
extensions.chaeo.products
import
export_patches_from_zstack
,
export_patch_masks_from_zstack
,
export_multichannel_patches_from_zstack
,
get_patches_from_zmask_meta
,
get_patch_masks_from_zmask_meta
from
extensions.chaeo.zmask
import
build_zmask_from_object_mask
,
project_stack_from_focal_points
from
extensions.ilastik.models
import
IlastikPixelClassifierModel
...
...
@@ -262,9 +263,7 @@ def infer_object_map_from_zstack(
)
# send patches and mask stacks to object classifier
result_acc
,
_
=
MonoPatchStack
(
object_classifier
.
infer
(
patches_acc
,
patch_masks_acc
)
)
result_acc
,
_
=
object_classifier
.
infer
(
patches_acc
,
patch_masks_acc
)
object_labels_map
=
np
.
copy
(
interm
[
'
label_map
'
])
assert
object_labels_map
.
shape
==
interm
[
'
label_map
'
].
shape
...
...
@@ -275,7 +274,7 @@ def infer_object_map_from_zstack(
mi
=
zmask_meta
[
ii
]
object_label_id
=
mi
[
'
info
'
].
label
result_label_map
=
result_acc
.
iat
(
ii
)
assert
(
result_label_map
.
shape
)
==
2
assert
result_label_map
.
ndim
==
2
unique_values
=
np
.
unique
(
result_label_map
)
assert
len
(
unique_values
)
==
2
assert
unique_values
[
0
]
==
0
...
...
@@ -385,12 +384,7 @@ def transfer_ecotaxa_labels_to_patch_stacks(
mask
=
dilation
(
mask
)
if
not
allow_multiple_objects
:
ob_id
=
label
(
acc_bm
.
data
[:,
:,
0
,
0
])
num_obj
=
len
(
np
.
unique
(
ob_id
))
-
1
if
num_obj
>
1
:
print
(
f
'
Found multiple nonzero unique values in mask
{
fi
}
; keeping the one with largest area
'
)
pr
=
regionprops_table
(
ob_id
,
properties
=
[
'
label
'
,
'
area
'
])
idx_max_area
=
pr
[
'
area
'
].
argmax
()
mask
=
255
*
(
ob_id
==
pr
[
'
label
'
][
idx_max_area
])
mask
=
mask_largest_object
(
ob_id
)
zstacks
[
dfk
+
'
_mask
'
][:,
:,
0
,
fi
]
=
mask
zstacks
[
dfk
+
'
_label
'
][:,
:,
0
,
fi
]
=
(
mask
==
255
)
*
aci
...
...
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