Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NutriMorph
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
DEBREUVE Eric
NutriMorph
Commits
acda0f74
Commit
acda0f74
authored
4 years ago
by
DEBREUVE Eric
Browse files
Options
Downloads
Patches
Plain Diff
added label for cursor info
parent
1f68b7fd
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
brick/interface/soma_validation.py
+16
-2
16 additions, 2 deletions
brick/interface/soma_validation.py
with
16 additions
and
2 deletions
brick/interface/soma_validation.py
+
16
−
2
View file @
acda0f74
...
...
@@ -15,6 +15,7 @@ class soma_validation_window_t:
"
mip_4_display
"
,
"
root
"
,
"
canvas
"
,
"
cursor_nfo
"
,
"
tk_image
"
,
"
canvas_image
"
,
)
...
...
@@ -23,6 +24,7 @@ class soma_validation_window_t:
mip_4_display
:
array_t
root
:
tknt
.
Tk
canvas
:
tknt
.
Canvas
cursor_nfo
:
tknt
.
Label
tk_image
:
tk_image_t
canvas_image
:
int
...
...
@@ -39,7 +41,10 @@ class soma_validation_window_t:
tk_image
=
_TkImageFromNumpyArray
(
mip_4_display
,
root
)
canvas_image
=
canvas
.
create_image
(
0
,
0
,
anchor
=
"
nw
"
,
image
=
tk_image
)
canvas
.
pack
()
cursor_nfo
=
tknt
.
Label
(
root
,
text
=
""
)
cursor_nfo
.
pack
()
canvas
.
bind
(
"
<Motion>
"
,
self
.
_DisplayLabel
)
canvas
.
bind
(
"
<Button-1>
"
,
self
.
_DeleteSoma
)
for
field
in
self
.
__class__
.
__slots__
:
...
...
@@ -50,6 +55,13 @@ class soma_validation_window_t:
self
.
root
.
mainloop
()
# scikit-image.relabel(self.lmap)
def
_DisplayLabel
(
self
,
event
:
tknt
.
EventType
.
Motion
)
->
None
:
""""""
row
=
event
.
y
col
=
event
.
x
value
=
self
.
mip
[
row
,
col
]
self
.
cursor_nfo
.
configure
(
text
=
f
"
Label:
{
value
}
@
{
row
}
x
{
col
}
"
)
def
_DeleteSoma
(
self
,
event
:
tknt
.
EventType
.
ButtonPress
)
->
None
:
""""""
row
=
event
.
y
...
...
@@ -85,7 +97,7 @@ def _ColoredVersion(image: array_t) -> array_t:
""""""
max_label
=
nmpy
.
amax
(
image
)
labels
=
tuple
(
range
(
1
,
max_label
+
1
))
labels
=
tuple
(
range
(
1
,
max_label
+
1
))
half_length
=
int
(
round
(
0.5
*
max_label
))
shuffled_labels
=
labels
[
half_length
:]
+
labels
[:
half_length
]
shuffled_image
=
nmpy
.
zeros_like
(
image
)
...
...
@@ -99,7 +111,9 @@ def _ColoredVersion(image: array_t) -> array_t:
return
output
.
astype
(
nmpy
.
uint8
)
def
_TkImageFromNumpyArray
(
array
:
array_t
,
parent
:
Union
[
tknt
.
Widget
,
tknt
.
Tk
])
->
tk_image_t
:
def
_TkImageFromNumpyArray
(
array
:
array_t
,
parent
:
Union
[
tknt
.
Widget
,
tknt
.
Tk
]
)
->
tk_image_t
:
""""""
pil_image
=
image_t
.
fromarray
(
array
)
output
=
tk_image_t
.
PhotoImage
(
master
=
parent
,
image
=
pil_image
)
...
...
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