Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
alibylite
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Swain Lab
aliby
alibylite
Commits
3bddfa58
Commit
3bddfa58
authored
3 years ago
by
Alán Muñoz
Browse files
Options
Downloads
Patches
Plain Diff
add background_max5
parent
11496d3a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
extraction/core/functions/defaults.py
+1
-0
1 addition, 0 deletions
extraction/core/functions/defaults.py
extraction/core/functions/trap.py
+16
-3
16 additions, 3 deletions
extraction/core/functions/trap.py
with
17 additions
and
3 deletions
extraction/core/functions/defaults.py
+
1
−
0
View file @
3bddfa58
...
...
@@ -30,6 +30,7 @@ def exparams_from_meta(meta: Union[dict, PosixPath, str], extras=["ph"]):
"
mean
"
,
"
median
"
,
"
imBackground
"
,
"
background_max5
"
,
"
max2p5pc
"
,
"
max2p5pc_med
"
,
"
max5px
"
,
...
...
This diff is collapsed.
Click to expand it.
extraction/core/functions/trap.py
+
16
−
3
View file @
3bddfa58
...
...
@@ -4,13 +4,26 @@ import numpy as np
def
imBackground
(
cell_masks
,
trap_image
):
'''
"""
:param cell_masks: (numpy 3d array) cells
'
segmentation mask
:param trap_image: the image for the trap in which the cell is (all
channels)
'''
"""
if
not
len
(
cell_masks
):
cell_masks
=
np
.
zeros_like
(
trap_image
)
background
=
~
cell_masks
.
sum
(
axis
=
2
).
astype
(
bool
)
return
(
np
.
median
(
trap_image
[
np
.
where
(
background
)]))
return
np
.
median
(
trap_image
[
np
.
where
(
background
)])
def
background_max5
(
cell_masks
,
trap_image
):
"""
:param cell_masks: (numpy 3d array) cells
'
segmentation mask
:param trap_image: the image for the trap in which the cell is (all
channels)
"""
if
not
len
(
cell_masks
):
cell_masks
=
np
.
zeros_like
(
trap_image
)
background
=
~
cell_masks
.
sum
(
axis
=
2
).
astype
(
bool
)
return
np
.
mean
(
np
.
sort
(
trap_image
[
np
.
where
(
background
)])[
-
5
:])
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