Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nd2shrink
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
Andrey ARISTOV
nd2shrink
Commits
0b08d8ff
Commit
0b08d8ff
authored
3 years ago
by
Andrey Aristov
Browse files
Options
Downloads
Patches
Plain Diff
fix segment
parent
63155b3d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/segment/seg.py
+1
-1
1 addition, 1 deletion
src/segment/seg.py
src/tests/test_segment.py
+12
-11
12 additions, 11 deletions
src/tests/test_segment.py
with
13 additions
and
12 deletions
src/segment/seg.py
+
1
−
1
View file @
0b08d8ff
...
...
@@ -20,7 +20,7 @@ def crop_center(array):
def
segment_bf
(
well
,
thr
=
0.2
,
smooth
=
10
,
erode
=
10
,
fill
=
True
,
plot
=
False
):
'''
Serments input 2d array using thresholded gradient with filling
Returns
SegmentedImage object
Returns
labels
'''
grad
=
multiwell
.
get_2d_gradient
(
well
)
sm
=
multiwell
.
gaussian_filter
(
grad
,
smooth
)
...
...
This diff is collapsed.
Click to expand it.
src/tests/test_segment.py
+
12
−
11
View file @
0b08d8ff
...
...
@@ -6,21 +6,22 @@ from skimage.transform import rotate
from
segment
import
seg
import
logging
from
droplet_growth.mic
import
regionprops
logging
.
basicConfig
(
level
=
logging
.
DEBUG
)
logger
=
logging
.
getLogger
(
__name__
)
#
def test_segment():
#
image = np.zeros((600, 600))
#
cx, cy, b, a = 300, 350, 50, 100
#
rr, cc = ellipse(cx, cy, b, a)
#
image[rr, cc] = 1.0
def
test_segment
():
image
=
np
.
zeros
((
600
,
600
))
cx
,
cy
,
b
,
a
=
300
,
350
,
50
,
100
rr
,
cc
=
ellipse
(
cx
,
cy
,
b
,
a
)
image
[
rr
,
cc
]
=
1.0
#
mask = seg.
find_spheroid
(image, plot=0)
#
props =
s
eg
.get_
props(mask)
#
logger.debug(f"len(props) {len(props)}")
#
np.testing.assert_almost_equal(
#
props[0]["eccentricity"], (1 - b ** 2 / a ** 2) ** 0.5, 0.02
#
)
mask
=
seg
.
segment_bf
(
image
,
plot
=
0
)
props
=
r
eg
ion
props
(
mask
)
logger
.
debug
(
f
"
len(props)
{
len
(
props
)
}
"
)
np
.
testing
.
assert_almost_equal
(
props
[
0
][
"
eccentricity
"
],
(
1
-
b
**
2
/
a
**
2
)
**
0.5
,
0.02
)
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