Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Y
YeaZ-GUI
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
chadhat
YeaZ-GUI
Commits
a51ca33e
Commit
a51ca33e
authored
3 years ago
by
lpbsscientist
Browse files
Options
Downloads
Patches
Plain Diff
SJR: latest
parent
25624956
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
GUI_main.py
+6
-1
6 additions, 1 deletion
GUI_main.py
init/InitButtons.py
+2
-0
2 additions, 0 deletions
init/InitButtons.py
unet/neural_network.py
+10
-2
10 additions, 2 deletions
unet/neural_network.py
unet/segment.py
+22
-4
22 additions, 4 deletions
unet/segment.py
with
40 additions
and
7 deletions
GUI_main.py
+
6
−
1
View file @
a51ca33e
...
@@ -1257,6 +1257,10 @@ class App(QMainWindow):
...
@@ -1257,6 +1257,10 @@ class App(QMainWindow):
if
do_draw
or
do_erase
:
if
do_draw
or
do_erase
:
self
.
m
.
tempmask
=
self
.
m
.
plotmask
.
copy
()
self
.
m
.
tempmask
=
self
.
m
.
plotmask
.
copy
()
#save status of the showval check box, then turn off (slows brush/eraser down too much)
self
.
showval_was_checked
=
self
.
button_showval
.
isChecked
()
self
.
button_showval
.
setChecked
(
False
)
if
do_draw
:
if
do_draw
:
self
.
WriteStatusBar
((
'
Draw using the brush, right click to select
'
self
.
WriteStatusBar
((
'
Draw using the brush, right click to select
'
'
the cell to draw.
'
))
'
the cell to draw.
'
))
...
@@ -1271,7 +1275,7 @@ class App(QMainWindow):
...
@@ -1271,7 +1275,7 @@ class App(QMainWindow):
self
.
id2
=
self
.
m
.
mpl_connect
(
'
button_press_event
'
,
self
.
id2
=
self
.
m
.
mpl_connect
(
'
button_press_event
'
,
lambda
e
:
self
.
m
.
OneClick
(
e
,
radius
))
lambda
e
:
self
.
m
.
OneClick
(
e
,
radius
))
self
.
id
=
self
.
m
.
mpl_connect
(
'
motion_notify_event
'
,
self
.
id
=
self
.
m
.
mpl_connect
(
'
motion_notify_event
'
,
lambda
e
:
self
.
m
.
PaintBrush
(
e
,
radius
))
lambda
e
:
self
.
m
.
PaintBrush
(
e
,
radius
))
self
.
id3
=
self
.
m
.
mpl_connect
(
'
button_release_event
'
,
self
.
m
.
ReleaseClick
)
self
.
id3
=
self
.
m
.
mpl_connect
(
'
button_release_event
'
,
self
.
m
.
ReleaseClick
)
...
@@ -1282,6 +1286,7 @@ class App(QMainWindow):
...
@@ -1282,6 +1286,7 @@ class App(QMainWindow):
QApplication
.
restoreOverrideCursor
()
QApplication
.
restoreOverrideCursor
()
self
.
Enable
(
self
.
button_drawmouse
)
self
.
Enable
(
self
.
button_drawmouse
)
self
.
Enable
(
self
.
button_eraser
)
self
.
Enable
(
self
.
button_eraser
)
self
.
button_showval
.
setChecked
(
self
.
showval_was_checked
)
self
.
SaveMask
()
self
.
SaveMask
()
self
.
ClearStatusBar
()
self
.
ClearStatusBar
()
...
...
This diff is collapsed.
Click to expand it.
init/InitButtons.py
+
2
−
0
View file @
a51ca33e
...
@@ -158,6 +158,8 @@ def Init(parent):
...
@@ -158,6 +158,8 @@ def Init(parent):
parent
.
button_changecellvalue
.
setEnabled
(
True
)
parent
.
button_changecellvalue
.
setEnabled
(
True
)
parent
.
button_changecellvalue
.
clicked
.
connect
(
parent
.
ChangeOneValue
)
parent
.
button_changecellvalue
.
clicked
.
connect
(
parent
.
ChangeOneValue
)
parent
.
button_changecellvalue
.
setMaximumWidth
(
150
)
parent
.
button_changecellvalue
.
setMaximumWidth
(
150
)
parent
.
button_changecellvalue
.
setShortcut
(
"
C
"
)
parent
.
button_changecellvalue
.
setToolTip
(
"
Shortcut: C
"
)
# parent.button_changecellvalue.setStatusTip('')
# parent.button_changecellvalue.setStatusTip('')
parent
.
button_changecellvalue
.
setStatusTip
(
'
Change ID value of one cell. Use left click to select one cell and enter a new ID value.
'
)
parent
.
button_changecellvalue
.
setStatusTip
(
'
Change ID value of one cell. Use left click to select one cell and enter a new ID value.
'
)
...
...
This diff is collapsed.
Click to expand it.
unet/neural_network.py
+
10
−
2
View file @
a51ca33e
...
@@ -65,9 +65,17 @@ def prediction(im, is_pc):
...
@@ -65,9 +65,17 @@ def prediction(im, is_pc):
input_size
=
(
None
,
None
,
1
))
input_size
=
(
None
,
None
,
1
))
if
is_pc
:
if
is_pc
:
path
=
path_weights
+
'
unet_weights_batchsize_25_Nepochs_100_SJR0_10.hdf5
'
path
=
'
/home/sjrahi/Research/YeaZ/unet_weights/2021_05_27_budding_BF_all/files-p-G/unet_weights_budding_BF_multilab-p-G_SJR_0_1_batchsize_10_Nepochs_250.hdf5
'
# '/home/sjrahi/Research/YeaZ/unet_weights/2021_04_15_Silke_pombe/unet_weights_pombe_Silke_all_SJR_0_1_batchsize_5_Nepochs_500.hdf5'
# path_weights + 'unet_weights_batchsize_25_Nepochs_100_SJR0_10.hdf5'
else
:
else
:
path
=
path_weights
+
'
weights_budding_BF_02.hdf5
'
path
=
'
/home/sjrahi/Research/YeaZ/unet_weights/2021_05_09_pombe_all/unet_weights_pombe_all_SJR_0_2_batchsize_8_Nepochs_400.hdf5
'
# '/home/sjrahi/Research/YeaZ/unet_weights/2021_04_15_Silke_pombe/unet_weights_BF_batchsize_15_Nepochs_400_SJR_0_1.hdf5'
# '/home/sjrahi/Research/YeaZ/unet_weights/2021_04_15_Silke_pombe/unet_weights_BF_batchsize_25_Nepochs_200_SJR_0_1.hdf5'
# '/home/sjrahi/Research/YeaZ/unet_weights/2021_04_15_Silke_pombe/unet_weights_epoch_600_batchsize_50_fold_1_4.hdf5'
# '/home/sjrahi/Research/YeaZ/unet_weights/2021_04_15_Silke_pombe/unet_weights_epoch_2000_batchsize_50_fold_1.hdf5'
# '/home/sjrahi/Research/YeaZ/unet_weights/2021_04_15_Silke_pombe/unet_weights_epoch_600_batchsize_50_fold_1_4.hdf5'
# path_weights + 'weights_budding_BF_02.hdf5'
if
not
os
.
path
.
exists
(
path
):
if
not
os
.
path
.
exists
(
path
):
raise
ValueError
(
'
Path does not exist
'
)
raise
ValueError
(
'
Path does not exist
'
)
...
...
This diff is collapsed.
Click to expand it.
unet/segment.py
+
22
−
4
View file @
a51ca33e
...
@@ -94,10 +94,12 @@ def cell_merge(wsh, pred):
...
@@ -94,10 +94,12 @@ def cell_merge(wsh, pred):
objcounter
=
objcounter
+
1
objcounter
=
objcounter
+
1
orig1
=
objs
[
obj1
,:,:]
orig1
=
objs
[
obj1
,:,:]
last_obj2_added_to_obj1
=
-
1
for
obj2
in
range
(
obj1
+
1
,
wsh
.
max
()):
for
obj2
in
range
(
obj1
+
1
,
wsh
.
max
()):
dil2
=
dil_objs
[
obj2
,:,:]
dil2
=
dil_objs
[
obj2
,:,:]
# only check border if bounding box overlaps, and second mask
# only check border if bounding box overlaps, and second mask
# is not yet deleted
# is not yet deleted
if
(
do_box_overlap
(
obj_coords
[
obj1
,:],
obj_coords
[
obj2
,:])
if
(
do_box_overlap
(
obj_coords
[
obj1
,:],
obj_coords
[
obj2
,:])
...
@@ -107,7 +109,7 @@ def cell_merge(wsh, pred):
...
@@ -107,7 +109,7 @@ def cell_merge(wsh, pred):
border_pred
=
pred
[
border
]
border_pred
=
pred
[
border
]
# Border is too small to be considered
# Border is too small to be considered
if
len
(
border_pred
)
<
32
:
if
len
(
border_pred
)
<
16
:
#SJR: Changed on 18.04.2021 from previously 32. Not sure why 32. I remember 8.
continue
continue
# Sum of top 25% of predicted border values
# Sum of top 25% of predicted border values
...
@@ -119,11 +121,27 @@ def cell_merge(wsh, pred):
...
@@ -119,11 +121,27 @@ def cell_merge(wsh, pred):
# merge cells
# merge cells
if
top_border_height
/
top_border_area
>
.
99
:
if
top_border_height
/
top_border_area
>
.
99
:
orig1
=
np
.
logical_or
(
orig1
,
objs
[
obj2
,:,:])
orig1
=
np
.
logical_or
(
orig1
,
objs
[
obj2
,:,:])
dil_objs
[
obj1
,:,:]
=
np
.
logical_or
(
dil1
,
dil2
)
dil1
=
np
.
logical_or
(
dil1
,
dil2
)
dil_objs
[
obj1
,:,:]
=
dil1
dil_objs
[
obj2
,:,:]
=
np
.
zeros
((
wshshape
[
0
],
wshshape
[
1
]))
dil_objs
[
obj2
,:,:]
=
np
.
zeros
((
wshshape
[
0
],
wshshape
[
1
]))
obj_coords
[
obj1
,:]
=
get_bounding_box
(
dil_objs
[
obj1
,:,:])
obj_coords
[
obj1
,:]
=
get_bounding_box
(
dil_objs
[
obj1
,:,:])
# obj_coords[obj2,:] = get_bounding_box(dil_objs[obj2,:,:])
last_obj2_added_to_obj1
=
obj2
# the last object that obj1 was merged with should be equal to obj1 so that additional cells could be merged with it
if
last_obj2_added_to_obj1
>
-
1
:
obj2
=
last_obj2_added_to_obj1
dil_objs
[
obj2
,:,:]
=
dil1
objs
[
obj2
,:,:]
=
orig1
obj_coords
[
obj2
,:]
=
get_bounding_box
(
dil_objs
[
obj2
,:,:])
wshclean
=
wshclean
+
orig1
*
objcounter
wshclean
=
(
1
-
orig1
)
*
wshclean
+
orig1
*
objcounter
# resort wshclean
u
=
np
.
unique
(
wshclean
)[
1
:]
#ignore background
for
obj1
in
range
(
len
(
u
)):
wshclean
[
wshclean
==
u
[
obj1
]]
=
obj1
+
1
return
wshclean
return
wshclean
...
...
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