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
c4798863
Commit
c4798863
authored
4 years ago
by
mattminder
Browse files
Options
Downloads
Patches
Plain Diff
Extract the disappeared cells as well
parent
1c1de90f
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
GUI_main.py
+7
-7
7 additions, 7 deletions
GUI_main.py
misc/Extract.py
+2
-0
2 additions, 0 deletions
misc/Extract.py
with
9 additions
and
7 deletions
GUI_main.py
+
7
−
7
View file @
c4798863
...
@@ -506,15 +506,15 @@ class App(QMainWindow):
...
@@ -506,15 +506,15 @@ class App(QMainWindow):
dlg
=
extr
.
Extract
(
image
,
mask
,
self
.
reader
.
channel_names
)
dlg
=
extr
.
Extract
(
image
,
mask
,
self
.
reader
.
channel_names
)
dlg
.
exec
()
dlg
.
exec
()
if
dlg
.
exit_code
==
1
:
# Fluorescence
if
dlg
.
exit_code
==
1
:
# Fluorescence
self
.
ExtractFluo
(
dlg
.
cells
,
dlg
.
outfile
,
dlg
.
file_list
)
self
.
ExtractFluo
(
dlg
.
cells
,
dlg
.
desel_cells
,
dlg
.
outfile
,
dlg
.
file_list
)
elif
dlg
.
exit_code
==
2
:
# Mask
elif
dlg
.
exit_code
==
2
:
# Mask
self
.
ExtractMask
(
dlg
.
cells
,
dlg
.
outfile
)
self
.
ExtractMask
(
dlg
.
desel_
cells
,
dlg
.
outfile
)
self
.
Enable
(
self
.
button_extractfluorescence
)
self
.
Enable
(
self
.
button_extractfluorescence
)
self
.
ClearStatusBar
()
self
.
ClearStatusBar
()
def
ExtractMask
(
self
,
cell_list
,
outfile
):
def
ExtractMask
(
self
,
desel_cells
,
outfile
):
"""
Extract the mask to the specified tiff file. Only take cells
"""
Extract the mask to the specified tiff file. Only take cells
specified by the cell_list
"""
specified by the cell_list
"""
...
@@ -530,15 +530,14 @@ class App(QMainWindow):
...
@@ -530,15 +530,14 @@ class App(QMainWindow):
continue
continue
mask
=
self
.
reader
.
LoadMask
(
time_index
,
self
.
FOVindex
)
mask
=
self
.
reader
.
LoadMask
(
time_index
,
self
.
FOVindex
)
all_cells
=
np
.
unique
(
mask
)
for
cell
in
desel_cells
:
for
cell
in
set
(
all_cells
)
-
set
(
cell_list
):
mask
[
mask
==
cell
]
=
0
mask
[
mask
==
cell
]
=
0
mask_list
.
append
(
mask
)
mask_list
.
append
(
mask
)
imageio
.
mimwrite
(
outfile
,
np
.
array
(
mask_list
,
dtype
=
np
.
uint16
))
imageio
.
mimwrite
(
outfile
,
np
.
array
(
mask_list
,
dtype
=
np
.
uint16
))
def
ExtractFluo
(
self
,
cells
_to_use
,
csv_filename
,
channel_list
):
def
ExtractFluo
(
self
,
sel_
cells
,
desel_cells
,
csv_filename
,
channel_list
):
"""
This is the function that takes as argument the filepath to the xls
"""
This is the function that takes as argument the filepath to the xls
file and writes in the file.
file and writes in the file.
It iterates over the different channels (or the sheets of the file,
It iterates over the different channels (or the sheets of the file,
...
@@ -601,7 +600,7 @@ class App(QMainWindow):
...
@@ -601,7 +600,7 @@ class App(QMainWindow):
if
val
==
0
:
if
val
==
0
:
continue
continue
# disregard cells not in cell_list
# disregard cells not in cell_list
if
not
(
val
in
cells_to_use
):
if
(
val
in
desel_cells
):
continue
continue
# Calculate stats
# Calculate stats
...
@@ -609,6 +608,7 @@ class App(QMainWindow):
...
@@ -609,6 +608,7 @@ class App(QMainWindow):
stats
[
'
Time
'
]
=
time_index
stats
[
'
Time
'
]
=
time_index
stats
[
'
Channel
'
]
=
channel
stats
[
'
Channel
'
]
=
channel
stats
[
'
Cell
'
]
=
val
stats
[
'
Cell
'
]
=
val
stats
[
'
Disappeared
'
]
=
not
(
val
in
sel_cells
)
cell_list
.
append
(
stats
)
cell_list
.
append
(
stats
)
# Use Pandas to write csv
# Use Pandas to write csv
...
...
This diff is collapsed.
Click to expand it.
misc/Extract.py
+
2
−
0
View file @
c4798863
...
@@ -139,6 +139,7 @@ class Extract(QDialog):
...
@@ -139,6 +139,7 @@ class Extract(QDialog):
self
.
exit_code
=
1
self
.
exit_code
=
1
self
.
cells
=
self
.
pc
.
sellist
self
.
cells
=
self
.
pc
.
sellist
self
.
desel_cells
=
set
(
np
.
unique
(
self
.
pc
.
mask
))
-
set
(
self
.
cells
)
self
.
close
()
self
.
close
()
def
do_cancel
(
self
):
def
do_cancel
(
self
):
...
@@ -157,6 +158,7 @@ class Extract(QDialog):
...
@@ -157,6 +158,7 @@ class Extract(QDialog):
self
.
exit_code
=
2
self
.
exit_code
=
2
self
.
cells
=
self
.
pc
.
sellist
self
.
cells
=
self
.
pc
.
sellist
self
.
desel_cells
=
set
(
np
.
unique
(
self
.
pc
.
mask
))
-
set
(
self
.
cells
)
self
.
close
()
self
.
close
()
def
do_sel_mult
(
self
):
def
do_sel_mult
(
self
):
...
...
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