Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
bob.bio.vein
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bob
bob.bio.vein
Commits
a21d16c5
Commit
a21d16c5
authored
Oct 24, 2016
by
Teodors EGLITIS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Utils for ROI annotations and more
parent
a42fe58c
Pipeline
#5084
failed with stages
in 10 minutes and 46 seconds
Changes
9
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
509 additions
and
1 deletion
+509
-1
MANIFEST.in
MANIFEST.in
+1
-1
bob/bio/vein/preprocessor/utils/__init__.py
bob/bio/vein/preprocessor/utils/__init__.py
+6
-0
bob/bio/vein/preprocessor/utils/utils.py
bob/bio/vein/preprocessor/utils/utils.py
+360
-0
bob/bio/vein/tests/preprocessors/0019_3_1_120509-160517.txt
bob/bio/vein/tests/preprocessors/0019_3_1_120509-160517.txt
+49
-0
bob/bio/vein/tests/preprocessors/ConstructAnnotations.npy
bob/bio/vein/tests/preprocessors/ConstructAnnotations.npy
+0
-0
bob/bio/vein/tests/preprocessors/ConstructAnnotations.png
bob/bio/vein/tests/preprocessors/ConstructAnnotations.png
+0
-0
bob/bio/vein/tests/preprocessors/ConstructAnnotations.txt
bob/bio/vein/tests/preprocessors/ConstructAnnotations.txt
+31
-0
bob/bio/vein/tests/test.py
bob/bio/vein/tests/test.py
+57
-0
doc/api.rst
doc/api.rst
+5
-0
No files found.
MANIFEST.in
View file @
a21d16c5
include README.rst bootstrap-buildout.py buildout.cfg COPYING
recursive-include doc *.py *.rst
recursive-include bob/bio/vein/tests *.png *.mat
recursive-include bob/bio/vein/tests *.png *.mat
*.txt *.npy
bob/bio/vein/preprocessor/utils/__init__.py
0 → 100644
View file @
a21d16c5
from
.utils
import
ManualRoiCut
from
.utils
import
ConstructVeinImage
from
.utils
import
RotateImage
# gets sphinx autodoc done right - don't remove it
__all__
=
[
_
for
_
in
dir
()
if
not
_
.
startswith
(
'_'
)]
bob/bio/vein/preprocessor/utils/utils.py
0 → 100644
View file @
a21d16c5
This diff is collapsed.
Click to expand it.
bob/bio/vein/tests/preprocessors/0019_3_1_120509-160517.txt
0 → 100644
View file @
a21d16c5
26 0
27 7
29 24
31 38
40 80
45 104
50 124
58 156
61 171
65 187
67 194
69 205
71 223
74 251
76 274
79 298
81 324
83 341
83 358
86 385
87 408
89 445
90 474
91 518
91 534
91 559
90 581
90 620
90 633
88 648
89 655
89 672
277 672
279 648
280 606
284 552
284 482
280 413
280 358
281 309
286 277
288 238
288 195
285 165
285 138
285 111
288 49
291 20
294 0
bob/bio/vein/tests/preprocessors/ConstructAnnotations.npy
0 → 100644
View file @
a21d16c5
File added
bob/bio/vein/tests/preprocessors/ConstructAnnotations.png
0 → 100644
View file @
a21d16c5
2.98 KB
bob/bio/vein/tests/preprocessors/ConstructAnnotations.txt
0 → 100644
View file @
a21d16c5
11 91
8 322
76 320
114 307
140 300
176 292
225 292
269 288
330 287
405 288
436 290
456 288
468 276
473 242
472 208
470 184
466 146
455 116
440 93
424 77
397 69
358 64
298 60
247 52
201 38
160 25
130 7
106 7
81 16
46 46
22 71
bob/bio/vein/tests/test.py
View file @
a21d16c5
...
...
@@ -14,6 +14,7 @@ the generated sphinx documentation)
import
os
import
numpy
import
numpy
as
np
import
nose.tools
import
pkg_resources
...
...
@@ -186,3 +187,59 @@ def test_miura_match():
score_imp
=
MM
.
score
(
template_vein
,
probe_imp_vein
)
assert
numpy
.
isclose
(
score_imp
,
0.172906739278421
)
def
test_manualRoiCut
():
from
bob.bio.vein.preprocessors.utils.utils
import
ManualRoiCut
image_path
=
F
((
'preprocessors'
,
'0019_3_1_120509-160517.png'
))
annotation_path
=
F
((
'preprocessors'
,
'0019_3_1_120509-160517.txt'
))
c
=
ManualRoiCut
(
annotation_path
,
image_path
)
mask_1
=
c
.
roi_mask
()
image_1
=
c
.
roi_image
()
# create mask using size:
c
=
ManualRoiCut
(
annotation_path
,
sizes
=
(
672
,
380
))
mask_2
=
c
.
roi_mask
()
# loading image:
image
=
bob
.
io
.
base
.
load
(
image_path
)
c
=
ManualRoiCut
(
annotation_path
,
image
)
mask_3
=
c
.
roi_mask
()
image_3
=
c
.
roi_image
()
# load text file:
with
open
(
annotation_path
,
'r'
)
as
f
:
retval
=
numpy
.
loadtxt
(
f
,
ndmin
=
2
)
# carefully -- this is BOB format --- (x,y)
annotation
=
list
([
tuple
([
k
[
0
],
k
[
1
]])
for
k
in
retval
])
c
=
ManualRoiCut
(
annotation
,
image
)
mask_4
=
c
.
roi_mask
()
image_4
=
c
.
roi_image
()
assert
(
mask_1
==
mask_2
).
all
()
assert
(
mask_1
==
mask_3
).
all
()
assert
(
mask_1
==
mask_4
).
all
()
assert
(
image_1
==
image_3
).
all
()
assert
(
image_1
==
image_4
).
all
()
def
test_ConstructAnnotations
():
"""
Test ConstructAnnotations preprocessor
"""
image_filename
=
"/idiap/home/teglitis/Desktop/REFACTOR_ALL/src/bob.bio.vein/bob/bio/vein/tests/preprocessors/ConstructAnnotations.png"
roi_annotations_filename
=
"/idiap/home/teglitis/Desktop/REFACTOR_ALL/src/bob.bio.vein/bob/bio/vein/tests/preprocessors/ConstructAnnotations.txt"
vein_annotations_filename
=
"/idiap/home/teglitis/Desktop/REFACTOR_ALL/src/bob.bio.vein/bob/bio/vein/tests/preprocessors/ConstructAnnotations.npy"
image
=
bob
.
io
.
base
.
load
(
image_filename
)
roi_annotations
=
np
.
loadtxt
(
roi_annotations_filename
,
dtype
=
'uint16'
)
roi_annotations
=
[
tuple
([
point
[
0
],
point
[
1
]])
for
point
in
roi_annotations
]
fp
=
open
(
vein_annotations_filename
,
'rt'
)
vein_annotations
=
np
.
load
(
fp
)
vein_annotations
=
vein_annotations
[
'arr_0'
].
tolist
()
fp
.
close
()
vein_annotations
=
[[
tuple
([
point
[
0
],
point
[
1
]])
for
point
in
line
]
for
line
in
vein_annotations
]
annotation_dictionary
=
{
"image"
:
image
,
"roi_annotations"
:
roi_annotations
,
"vein_annotations"
:
vein_annotations
}
from
bob.bio.vein.preprocessors
import
ConstructAnnotations
preprocessor
=
ConstructAnnotations
(
center
=
True
,
rotate
=
True
)
output
=
preprocessor
(
annotation_dictionary
)
assert
np
.
array_equal
(
output
,
image
)
doc/api.rst
View file @
a21d16c5
...
...
@@ -24,6 +24,11 @@ Pre-processors
.. automodule:: bob.bio.vein.preprocessor
Pre-processor utilities
-----------------------
.. automodule:: bob.bio.vein.preprocessor.utils
Feature Extractors
------------------
...
...
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