Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.bio.vein
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
bob
bob.bio.vein
Commits
9a317867
Commit
9a317867
authored
7 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
Support view mode w/o extracted veins
parent
1060d415
No related branches found
No related tags found
1 merge request
!35
3DFV and multiple fixes
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/bio/vein/script/view_sample.py
+20
-14
20 additions, 14 deletions
bob/bio/vein/script/view_sample.py
with
20 additions
and
14 deletions
bob/bio/vein/script/view_sample.py
+
20
−
14
View file @
9a317867
...
...
@@ -93,7 +93,7 @@ def save_figures(title, image, mask, image_pp, binary):
'
binarized.png
'
))
def
proof_figure
(
title
,
image
,
mask
,
image_pp
,
binary
):
def
proof_figure
(
title
,
image
,
mask
,
image_pp
,
binary
=
None
):
'''
Builds a proof canvas out of individual images
...
...
@@ -111,8 +111,9 @@ def proof_figure(title, image, mask, image_pp, binary):
image_pp (numpy.ndarray): A version of the original image, pre-processed by
one of the available algorithms
binary (numpy.ndarray): A binarized version of the original image in which
all pixels (should) represent vein (``True``) or not-vein (``False``)
binary (numpy.ndarray, Optional): A binarized version of the original image
in which all pixels (should) represent vein (``True``) or not-vein
(``False``)
Returns:
...
...
@@ -122,24 +123,27 @@ def proof_figure(title, image, mask, image_pp, binary):
'''
fig
=
mpl
.
figure
(
figsize
=
(
6
,
9
),
dpi
=
50
)
#900 x 300 pixels
fig
=
mpl
.
figure
(
figsize
=
(
6
,
9
),
dpi
=
100
)
images
=
3
if
binary
is
not
None
else
2
# add original image
mpl
.
subplot
(
3
,
1
,
1
)
mpl
.
subplot
(
images
,
1
,
1
)
mpl
.
title
(
'
%s - original
'
%
title
)
mpl
.
imshow
(
image
,
cmap
=
"
gray
"
)
# add preprocessed image
from
..preprocessor
import
utils
img
=
utils
.
draw_mask_over_image
(
image_pp
,
mask
)
mpl
.
subplot
(
3
,
1
,
2
)
mpl
.
subplot
(
images
,
1
,
2
)
mpl
.
title
(
'
Preprocessed
'
)
mpl
.
imshow
(
img
)
# add binary image
mpl
.
subplot
(
3
,
1
,
3
)
mpl
.
title
(
'
Binarized
'
)
mpl
.
imshow
(
binary
.
astype
(
'
uint8
'
)
*
255
,
cmap
=
"
gray
"
)
if
binary
is
not
None
:
# add binary image
mpl
.
subplot
(
3
,
1
,
3
)
mpl
.
title
(
'
Binarized
'
)
mpl
.
imshow
(
binary
.
astype
(
'
uint8
'
)
*
255
,
cmap
=
"
gray
"
)
return
fig
...
...
@@ -172,16 +176,18 @@ def main(user_input=None):
# Loads the image, the mask and save it to a PNG file
for
stem
in
args
[
'
<stem>
'
]:
image
=
bob
.
bio
.
base
.
load
(
os
.
path
.
join
(
args
[
'
<database>
'
],
stem
+
'
.png
'
))
image
=
numpy
.
rot90
(
image
,
k
=-
1
)
pp
=
bob
.
io
.
base
.
HDF5File
(
os
.
path
.
join
(
args
[
'
<processed>
'
],
'
preprocessed
'
,
stem
+
'
.hdf5
'
))
mask
=
pp
.
read
(
'
mask
'
)
image_pp
=
pp
.
read
(
'
image
'
)
binary
=
bob
.
io
.
base
.
load
(
os
.
path
.
join
(
args
[
'
<processed>
'
],
'
extracted
'
,
stem
+
'
.hdf5
'
))
binary_path
=
os
.
path
.
join
(
args
[
'
<processed>
'
],
'
extracted
'
,
stem
+
'
.hdf5
'
)
if
os
.
path
.
exists
(
binary_path
):
binary
=
bob
.
io
.
base
.
load
(
binary_path
)
else
:
binary
=
None
fig
=
proof_figure
(
stem
,
image
,
mask
,
image_pp
,
binary
)
#fig.title(stem)
if
args
[
'
--save
'
]:
#fig.savefig(args['--save'])
save_figures
(
args
[
'
--save
'
],
image
,
mask
,
image_pp
,
binary
)
else
:
mpl
.
show
()
...
...
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