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
d2b233d0
Commit
d2b233d0
authored
1 year ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
Debugging handling of multiple objects in patch
parent
f686512c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
extensions/chaeo/accessors.py
+2
-2
2 additions, 2 deletions
extensions/chaeo/accessors.py
extensions/chaeo/process.py
+6
-0
6 additions, 0 deletions
extensions/chaeo/process.py
extensions/chaeo/workflows.py
+10
-3
10 additions, 3 deletions
extensions/chaeo/workflows.py
with
18 additions
and
5 deletions
extensions/chaeo/accessors.py
+
2
−
2
View file @
d2b233d0
...
@@ -16,8 +16,8 @@ class MonoPatchStack(InMemoryDataAccessor):
...
@@ -16,8 +16,8 @@ class MonoPatchStack(InMemoryDataAccessor):
assert
data
.
ndim
==
3
assert
data
.
ndim
==
3
self
.
_data
=
np
.
expand_dims
(
data
,
2
)
self
.
_data
=
np
.
expand_dims
(
data
,
2
)
elif
isinstance
(
data
,
list
):
# list of YX patches
elif
isinstance
(
data
,
list
):
# list of YX patches
nda
=
np
.
array
(
data
)
nda
=
np
.
array
(
data
)
.
squeeze
()
assert
nda
.
squeeze
().
ndim
==
3
assert
nda
.
ndim
==
3
self
.
_data
=
np
.
expand_dims
(
self
.
_data
=
np
.
expand_dims
(
np
.
moveaxis
(
np
.
moveaxis
(
nda
,
nda
,
...
...
This diff is collapsed.
Click to expand it.
extensions/chaeo/process.py
+
6
−
0
View file @
d2b233d0
...
@@ -16,6 +16,12 @@ def mask_largest_object(
...
@@ -16,6 +16,12 @@ def mask_largest_object(
"""
"""
binary
=
img
>
0
binary
=
img
>
0
ob_id
=
label
(
binary
)
ob_id
=
label
(
binary
)
# separate problem for mask and object maps
# import skimage
# from pathlib import Path
# where = Path('c:/Users/rhodes/projects/proj0011-plankton-seg/tmp')
# skimage.io.imsave(where / 'raw.png', img)
num_obj
=
len
(
np
.
unique
(
ob_id
))
-
1
num_obj
=
len
(
np
.
unique
(
ob_id
))
-
1
if
num_obj
>
max_allowed
:
if
num_obj
>
max_allowed
:
raise
TooManyObjectError
(
f
'
Found
{
num_obj
}
objects in frame
'
)
raise
TooManyObjectError
(
f
'
Found
{
num_obj
}
objects in frame
'
)
...
...
This diff is collapsed.
Click to expand it.
extensions/chaeo/workflows.py
+
10
−
3
View file @
d2b233d0
...
@@ -273,14 +273,21 @@ def infer_object_map_from_zstack(
...
@@ -273,14 +273,21 @@ def infer_object_map_from_zstack(
for
ii
in
range
(
0
,
len
(
zmask_meta
)):
for
ii
in
range
(
0
,
len
(
zmask_meta
)):
mi
=
zmask_meta
[
ii
]
mi
=
zmask_meta
[
ii
]
object_label_id
=
mi
[
'
info
'
].
label
object_label_id
=
mi
[
'
info
'
].
label
result_label_map
=
result_acc
.
iat
(
ii
)
result_label_map
=
mask_largest_object
(
result_acc
.
iat
(
ii
)
)
assert
result_label_map
.
ndim
==
2
assert
result_label_map
.
ndim
==
2
unique_values
=
np
.
unique
(
result_label_map
)
unique_values
=
np
.
unique
(
result_label_map
)
assert
len
(
unique_values
)
==
2
if
not
len
(
unique_values
)
==
2
:
mask_largest_object
(
result_label_map
)
raise
Exception
()
assert
unique_values
[
0
]
==
0
assert
unique_values
[
0
]
==
0
ii_mask
=
object_labels_map
==
object_label_id
ii_mask
=
object_labels_map
==
object_label_id
object_labels_map
[
ii_mask
]
=
unique_values
[
1
]
object_labels_map
[
ii_mask
]
=
unique_values
[
1
]
patch
=
patches_acc
.
iat
(
ii
)
# object_labels_map[ii_mask] = np.unique(
# mask_largest_object(
# result_acc.iat(ii)
# )
# )[1]
# patch = patches_acc.iat(ii)
write_accessor_data_to_file
(
write_accessor_data_to_file
(
Path
(
output_folder_path
)
/
'
obj_classes_
'
/
(
fstem
+
'
.tif
'
),
Path
(
output_folder_path
)
/
'
obj_classes_
'
/
(
fstem
+
'
.tif
'
),
...
...
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