Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LarvaTagger.jl
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
Nyx
LarvaTagger.jl
Commits
a27719e0
Commit
a27719e0
authored
3 years ago
by
François LAURENT
Browse files
Options
Downloads
Patches
Plain Diff
improved handling of keyboard events (arrow keys) + version increment
parent
5780ecba
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#83177
passed
3 years ago
Stage: test
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
Project.toml
+1
-1
1 addition, 1 deletion
Project.toml
src/controllers.jl
+1
-0
1 addition, 0 deletions
src/controllers.jl
src/players.jl
+18
-0
18 additions, 0 deletions
src/players.jl
src/plots.jl
+17
-1
17 additions, 1 deletion
src/plots.jl
src/wgl.jl
+5
-9
5 additions, 9 deletions
src/wgl.jl
with
42 additions
and
11 deletions
Project.toml
+
1
−
1
View file @
a27719e0
name
=
"LarvaTagger"
uuid
=
"8b3b36f1-dfed-446e-8561-ea19fe966a4d"
authors
=
[
"François Laurent"
,
"Institut Pasteur"
]
version
=
"0.
4
.0"
version
=
"0.
5
.0"
[deps]
Colors
=
"5ae59095-9a9b-59fe-a467-6f913c188581"
...
...
This diff is collapsed.
Click to expand it.
src/controllers.jl
+
1
−
0
View file @
a27719e0
...
...
@@ -216,6 +216,7 @@ setboundingbox!(c::LarvaController, bb) = (c.boundingbox[] = bb)
getmedianlarvasize
(
c
)
=
getmedianlarvasize
(
gethub
(
c
)[
:
larva
])
getmedianlarvasize
(
c
::
LarvaController
)
=
c
.
medianlarvasize
getplayer
(
c
::
AbstractAnimator
)
=
c
getplayer
(
c
::
LarvaController
)
=
c
.
player
getplayer
(
c
)
=
getplayer
(
gethub
(
c
))
getplayer
(
hub
::
ControllerHub
)
=
haskey
(
hub
,
:
player
)
?
hub
[
:
player
]
:
getplayer
(
hub
[
:
larva
])
...
...
This diff is collapsed.
Click to expand it.
src/players.jl
+
18
−
0
View file @
a27719e0
...
...
@@ -117,6 +117,24 @@ play!(controller::TimeController) = (controller.playing[] = true)
pause!
(
controller
::
TimeController
)
=
(
controller
.
playing
[]
=
false
)
playpause!
(
controller
::
TimeController
)
=
(
controller
.
playing
[]
=
!
controller
.
playing
[])
function
stepforward!
(
controller
::
TimeController
)
step
=
controller
.
timestep
[]
if
step
<
controller
.
stepmax
[]
controller
.
timestep
[]
=
step
+
1
elseif
isplaying
(
controller
)
pause!
(
controller
)
end
end
function
stepbackward!
(
controller
::
TimeController
)
step
=
controller
.
timestep
[]
if
controller
.
stepmin
[]
<
step
controller
.
timestep
[]
=
step
-
1
elseif
isplaying
(
controller
)
pause!
(
controller
)
end
end
function
timecontroller
(
times
::
Vector
{
Float64
};
speed
=
1.1
)
issorted
(
times
)
||
throw
(
ArgumentError
(
"timestamps are not sorted"
))
initialstep
=
1
...
...
This diff is collapsed.
Click to expand it.
src/plots.jl
+
17
−
1
View file @
a27719e0
...
...
@@ -300,7 +300,8 @@ function assign_tag_to_segment!(larvaview, firststep)
flag_active_larva_as_edited
(
controller
)
end
function
setmouseevents!
(
scene
,
larva
::
SingleLarvaView
;
blocking
=
true
,
priority
=
Int8
(
10
),
kwargs
...
)
function
setmouseevents!
(
scene
,
larva
::
SingleLarvaView
;
blocking
=
true
,
priority
=
Int8
(
10
),
kwargs
...
)
# WGLMakie does not support addmouseevents! with plots as additional input args
mouseevents
=
Makie
.
addmouseevents!
(
scene
;
priority
=
priority
)
...
...
@@ -406,6 +407,7 @@ function Makie.plot!(plot::LarvaPlot{Tuple{SingleLarvaView}})
larva
=
plot
[
1
][]
scene
=
plot
.
parent
setmouseevents!
(
scene
,
larva
)
setkeyboardevents!
(
scene
,
larva
)
larvaplot!
(
plot
,
larva
.
path
,
larva
.
outline
,
larva
.
outline_color
,
larva
.
visible
)
if
iseditable
(
larva
)
lines!
(
plot
,
larva
.
segment
;
color
=
larva
.
segment_color
,
linewidth
=
6
,
visible
=
larva
.
segment_visible
)
...
...
@@ -413,6 +415,20 @@ function Makie.plot!(plot::LarvaPlot{Tuple{SingleLarvaView}})
end
end
setkeyboardevents!
(
scene
::
Scene
,
larva
::
SingleLarvaView
)
=
setkeyboardevents!
(
scene
,
larva
.
controller
)
function
setkeyboardevents!
(
scene
::
Scene
,
controller
)
player
=
getplayer
(
controller
)
on
(
events
(
scene
)
.
keyboardbutton
)
do
event
if
event
.
action
==
Keyboard
.
press
if
event
.
key
in
(
Keyboard
.
left
,
Keyboard
.
down
)
stepbackward!
(
player
)
elseif
event
.
key
in
(
Keyboard
.
right
,
Keyboard
.
up
)
stepforward!
(
player
)
end
end
end
end
##
struct
DecoratedLarva
...
...
This diff is collapsed.
Click to expand it.
src/wgl.jl
+
5
−
9
View file @
a27719e0
...
...
@@ -124,7 +124,8 @@ function AssayPlot(ctrl, larvae::DecoratedLarvae; size=FIGSIZE)
ax
=
Axis
(
fig
.
layout
[
1
,
1
],
aspect
=
DataAspect
(),
xgridwidth
=
width
,
ygridwidth
=
width
,
xgridcolor
=
color
,
ygridcolor
=
color
)
autosize!
(
ax
,
size
)
larvaplot!
(
ax
,
larvae
)
plot
=
larvaplot!
(
ax
,
larvae
)
setkeyboardevents!
(
plot
.
parent
,
getplayer
(
ctrl
))
setbounds!
(
ax
,
ctrl
,
larvae
)
button
=
homebutton
()
on
(
button
.
click
)
do
_
...
...
@@ -239,10 +240,7 @@ end
function
stepforwardbutton
(
ctrl
::
TimeController
;
kwargs
...
)
button
=
simpletrigger
(
StepForwardButton
,
with_attributes
(
kwargs
;
class
=
css_button
))
on
(
button
.
click
)
do
_
step
=
ctrl
.
timestep
[]
if
step
<
ctrl
.
stepmax
[]
ctrl
.
timestep
[]
=
step
+
1
end
stepforward!
(
ctrl
)
end
return
button
end
...
...
@@ -260,10 +258,7 @@ end
function
stepbackwardbutton
(
ctrl
::
TimeController
;
kwargs
...
)
button
=
simpletrigger
(
StepBackwardButton
,
with_attributes
(
kwargs
;
class
=
css_button
))
on
(
button
.
click
)
do
_
step
=
ctrl
.
timestep
[]
if
ctrl
.
stepmin
[]
<
step
ctrl
.
timestep
[]
=
step
-
1
end
stepbackward!
(
ctrl
)
end
return
button
end
...
...
@@ -362,6 +357,7 @@ function JSServe.jsrender(session::Session, p::Player)
r
(
session
,
p
.
stepforwardbutton
),
r
(
session
,
p
.
timeslider
),
r
(
session
,
p
.
timelabel
);
onmouseenter
=
js
"LarvaTagger.focusOnTimeSlider(this)"
,
p
.
attributes
...
))
end
...
...
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