Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
quality_check_gui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Wallenfang, Nils
quality_check_gui
Commits
4d3a2eac
Commit
4d3a2eac
authored
Jul 28, 2020
by
Wallenfang, Nils
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save marked preview in preview directory
parent
d68f7834
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
12 deletions
+14
-12
TODO.md
TODO.md
+3
-3
generate_preview.py
generate_preview.py
+1
-1
quality_check_gui.py
quality_check_gui.py
+10
-8
resources/DejaVuSans.ttf
resources/DejaVuSans.ttf
+0
-0
No files found.
TODO.md
View file @
4d3a2eac
...
...
@@ -8,10 +8,10 @@ Tasks related to the quality check algorithms.
## Previews
-
[
] Put font file in resources directory
-
[
X
] Put font file in resources directory
-
[x] Add checkbox to mark outlier pixels in preview
-
Also save clean preview
-
[
] Save marked preview in preview directory
-
[
X
] Save marked preview in preview directory
## GUI / UX
...
...
@@ -24,7 +24,7 @@ Tasks related to the quality check algorithms.
## Technical
-
[ ] validate config input
-
[ ] add requirements.txt or setup.py
-
[
] use default config file that is used when no config is found
-
[
X
] use default config file that is used when no config is found
# DONE
-
[X] introduce pixel sampling quality check
-
[X] automatically filter tiles without tissue
\ No newline at end of file
generate_preview.py
View file @
4d3a2eac
...
...
@@ -127,7 +127,7 @@ def insert_labels(preview, xdim, ydim):
img
=
Image
.
fromarray
(
preview
)
draw
=
ImageDraw
.
Draw
(
img
)
preview_tile_x
=
preview
.
shape
[
0
]
/
xdim
font
=
ImageFont
.
truetype
(
config
[
'PREVIEWS'
][
'font_path'
]
,
int
(
preview_tile_x
*
0.08
))
font
=
ImageFont
.
truetype
(
'resources/DejaVuSans.ttf'
,
int
(
preview_tile_x
*
0.08
))
# TODO scale font with resolution
# tile dimensions
...
...
quality_check_gui.py
View file @
4d3a2eac
...
...
@@ -134,9 +134,11 @@ def clicked_start(frame):
if
frame
.
mark_outliers_state
.
get
():
# generate preview with marked outliers
# TODO catch error when no preview was generated
marked_preview
=
mark_preview
(
preview
,
error_matrix
,
outlier_coords
,
filtered_coords
)
plt
.
imsave
(
'marked_preview.png'
,
marked_preview
)
# TODO fix path (not program dir)
subprocess
.
Popen
([
config
[
'PREVIEWS'
][
'fiji_path'
],
'marked_preview.png'
])
norm
=
os
.
path
.
normpath
(
path
)
# identify the section that is being analysed by its directory name
dir_name
=
norm
.
split
(
os
.
sep
)[
-
2
]
+
'_marked'
save_preview
(
marked_preview
,
frame
,
dir_name
)
frame
.
print
(
f
''
)
frame
.
progress_text
.
set
(
'Done!'
)
...
...
@@ -144,13 +146,10 @@ def clicked_start(frame):
threading
.
Thread
(
target
=
logic_thread_task
).
start
()
def
save_preview
(
preview
,
frame
,
tiff_path
):
def
save_preview
(
preview
,
frame
,
dir_name
):
preview_root
=
config
[
'PREVIEWS'
][
'preview_path'
]
# save preview to a fixed path
time_stamp
=
datetime
.
now
(
tzlocal
()).
strftime
(
'%Y%m%d_%H-%M'
)
norm
=
os
.
path
.
normpath
(
tiff_path
)
# identify the section that is being analysed by its directory name
dir_name
=
norm
.
split
(
os
.
sep
)[
-
2
]
preview_path
=
f
'
{
preview_root
}
/
{
dir_name
}
_
{
time_stamp
}
.png'
# TODO ensure no file overrides happen
...
...
@@ -206,7 +205,10 @@ def process_preview_gen(frame, tiff_path):
time_post
=
time
.
time
()
frame
.
print
(
f
'Generated preview in
{
time_post
-
time_pre
:.
2
f
}
s'
)
save_preview
(
preview
,
frame
,
tiff_path
)
norm
=
os
.
path
.
normpath
(
tiff_path
)
# identify the section that is being analysed by its directory name
dir_name
=
norm
.
split
(
os
.
sep
)[
-
2
]
save_preview
(
preview
,
frame
,
dir_name
)
return
preview
...
...
resources/DejaVuSans.ttf
0 → 100644
View file @
4d3a2eac
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment