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
176aa03f
Commit
176aa03f
authored
2 years ago
by
Alán Muñoz
Browse files
Options
Downloads
Patches
Plain Diff
remove(ext): delete faiss and k2_major_median
parent
802996f6
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
src/extraction/core/functions/cell.py
+0
-32
0 additions, 32 deletions
src/extraction/core/functions/cell.py
with
0 additions
and
32 deletions
src/extraction/core/functions/cell.py
+
0
−
32
View file @
176aa03f
...
@@ -13,7 +13,6 @@ import math
...
@@ -13,7 +13,6 @@ import math
import
typing
as
t
import
typing
as
t
import
bottleneck
as
bn
import
bottleneck
as
bn
import
faiss
import
numpy
as
np
import
numpy
as
np
from
scipy
import
ndimage
from
scipy
import
ndimage
...
@@ -121,37 +120,6 @@ def std(cell_mask, trap_image):
...
@@ -121,37 +120,6 @@ def std(cell_mask, trap_image):
return
np
.
std
(
trap_image
[
cell_mask
])
return
np
.
std
(
trap_image
[
cell_mask
])
def
k2_major_median
(
cell_mask
,
trap_image
):
"""
Finds the medians of the major cluster after clustering the pixels in the cell into two clusters.
Parameters
----------
cell_mask: 2d array
Segmentation mask for the cell
trap_image: 2d array
Returns
-------
median: float
The median of the major cluster of two clusters
"""
if
bn
.
anynan
(
trap_image
):
cell_mask
[
np
.
isnan
(
trap_image
)]
=
False
X
=
trap_image
[
cell_mask
].
reshape
(
-
1
,
1
).
astype
(
np
.
float32
)
# cluster pixels in cell into two clusters
indices
=
faiss
.
IndexFlatL2
(
X
.
shape
[
1
])
# (n_clusters=2, random_state=0).fit(X)
_
,
indices
=
indices
.
search
(
X
,
k
=
2
)
high_indices
=
np
.
argmax
(
indices
,
axis
=
1
).
astype
(
bool
)
# find the median of pixels in the largest cluster
# high_masks = np.logical_xor( # Use casting to obtain masks
# high_indices.reshape(-1, 1), np.tile((0, 1), X.shape[0]).reshape(-1, 2)
# )
major_median
=
bn
.
median
(
X
[
high_indices
])
return
major_median
def
volume
(
cell_mask
)
->
float
:
def
volume
(
cell_mask
)
->
float
:
"""
"""
Estimates the volume of the cell assuming it is an ellipsoid with the mask providing a cross-section through the median plane of the ellipsoid.
Estimates the volume of the cell assuming it is an ellipsoid with the mask providing a cross-section through the median plane of the ellipsoid.
...
...
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