Skip to content

Commit

Permalink
Fix left and right, use math polar angle convention consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
mkitti committed Sep 20, 2024
1 parent 5e5197b commit 71ec0d1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
13 changes: 6 additions & 7 deletions src/demo_averaging.jl
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function average_sliders(smts::ShroffCelegansModels.StraightenedModelTimeSeries)

mesh!(ax, _mesh; colorrange, color = _color, shading)
meshscatter!(ax, _seam_cells; markersize = 10.0, color = :gray, alpha = 0.5)
text!(ax, _seam_cell_labels; text = [model.names[1:2:end]; replace.(model.names[1:2:end], 'L' => 'R')], align = (:right, :bottom))
text!(ax, _seam_cell_labels; text = [replace.(model.names[1:2:end], 'L' => 'R'); model.names[1:2:end]], align = (:right, :bottom))
lines!(ax, _lines, color = :black)
ylims!(ax, (0, 1000))

Expand Down Expand Up @@ -229,7 +229,7 @@ function average_sliders_with_volumes(smts::ShroffCelegansModels.StraightenedMod

mesh!(ax, _mesh; colorrange, color = _color, shading)
meshscatter!(ax, _seam_cells; markersize = 10.0, color = :gray, alpha = 0.5)
text!(ax, _seam_cell_labels; text = [model.names[1:2:end]; replace.(model.names[1:2:end], 'L' => 'R')], align = (:right, :bottom))
text!(ax, _seam_cell_labels; text = [replace.(model.names[1:2:end], 'L' => 'R'); model.names[1:2:end]], align = (:right, :bottom))
lines!(ax, _lines, color = :black)
ylims!(ax, (0, 1000))

Expand Down Expand Up @@ -350,7 +350,7 @@ function show_average_models(models)

mesh!(ax, _mesh; colorrange, color = _color, shading)
meshscatter!(ax, _seam_cells; markersize = 10.0, color = :gray, alpha = 0.5)
text!(ax, _seam_cell_labels; text = [model.names[1:2:end]; replace.(model.names[1:2:end], 'L' => 'R')], align = (:right, :bottom))
text!(ax, _seam_cell_labels; text = [replace.(model.names[1:2:end], 'L' => 'R'); model.names[1:2:end]], align = (:right, :bottom))
lines!(ax, _lines, color = :black)
ylims!(ax, (0, 1000))

Expand Down Expand Up @@ -595,7 +595,7 @@ function show_average_models_with_annotations(
mesh!(ax, _mesh; colorrange, color = _color, transparency = true, alpha = 0.1)
meshscatter!(ax, _seam_cells; markersize = 1.0, color = :gray, alpha = 1)
meshscatter!(ax, _annotation_cells; markersize = 1.0, color = use_myuntwist ? :gold : :blue, alpha = 1)
text!(ax, _seam_cell_labels; text = [model.names[1:2:end]; replace.(model.names[1:2:end], 'L' => 'R')], align = (:right, :bottom))
text!(ax, _seam_cell_labels; text = [replace.(model.names[1:2:end], 'L' => 'R'); model.names[1:2:end]], align = (:right, :bottom))
text!(ax, _annotation_cells; text = _annotation_text, align = (:right, :bottom))
#lines!(ax, _lines, color = :black)
ylims!(ax, (0, 200))
Expand Down Expand Up @@ -721,7 +721,7 @@ function show_average_models_with_annotations_demo(models, _annotation_positions
mesh!(ax, _mesh; colorrange, color = _color, transparency = true, alpha = 0.1)
meshscatter!(ax, _seam_cells; markersize = 1.0, color = :gray, alpha = 1)
meshscatter!(ax, _annotation_cells; markersize = 1.0, color = :blue, alpha = 1)
text!(ax, _seam_cell_labels; text = [model.names[1:2:end]; replace.(model.names[1:2:end], 'L' => 'R')], align = (:right, :bottom))
text!(ax, _seam_cell_labels; text = [replace.(model.names[1:2:end], 'L' => 'R'); model.names[1:2:end]], align = (:right, :bottom))
text!(ax, _annotation_cells; text = collect(keys(annotation_dict)), align = (:right, :bottom))
#lines!(ax, _lines, color = :black)
ylims!(ax, (0, 200))
Expand Down Expand Up @@ -792,7 +792,6 @@ function mipav_df_to_point_dict(df::DataFrame)
end |> Dict
end

second(x) = x[2]

include("demo_averaging/debug_average_models_with_annotations.jl")
include("demo_averaging/show_average_annotations.jl")
Expand All @@ -804,7 +803,7 @@ function check_dataset(dataset; show_data_frames = false)
if !isfile(filepath)
if t dataset.cell_key.outliers
@error "$filepath does not exist and is not an outlier"
println():wait
println()
end
continue
end
Expand Down
24 changes: 13 additions & 11 deletions src/demo_averaging/debug_average_models_with_annotations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ function debug_average_models_with_annotations(
use_myuntwist = false,
cache = use_myuntwist ? my_annotation_position_cache : annotation_position_cache
)
second(x) = x[2]

f = Figure(size = (1920, 1080))

title_prewarp = Observable("Prewarp")
Expand Down Expand Up @@ -42,11 +44,11 @@ function debug_average_models_with_annotations(
end

mts = smts.modelTimeSeries
mts_nt = let _length = length(range(dataset.cell_key))
mts_nt = let _range = range(dataset.cell_key)
x -> begin
nt = x * (_length - 1) + 1.0
nt = x * (length(_range) - 1) + 1.0
nt = round(Int, nt)
title_twisted[] = "Twisted; idx = $nt"
title_twisted[] = "Twisted; idx = $nt, tp = $(_range[nt])"
mts(nt)
end
end
Expand Down Expand Up @@ -179,7 +181,7 @@ function debug_average_models_with_annotations(
mesh!(ax, _mesh; colorrange, color = _color, transparency = true, alpha = 0.1)
meshscatter!(ax, _seam_cells; markersize = 1.0, color = :gray, alpha = 1)
meshscatter!(ax, _annotation_cells; markersize = 1.0, color = use_myuntwist ? :gold : :blue, alpha = 1)
text!(ax, _seam_cell_labels; text = [model.names[1:2:end]; replace.(model.names[1:2:end], 'L' => 'R')], align = (:right, :bottom))
text!(ax, _seam_cell_labels; text = [replace.(model.names[1:2:end], 'L' => 'R'); model.names[1:2:end]], align = (:right, :bottom))
ann_txt = text!(ax, _annotation_cells; text = _annotation_text, align = (:right, :bottom))
connect!(ann_txt.visible, annotation_text_toggle.active)
#lines!(ax, _lines, color = :black)
Expand All @@ -188,13 +190,13 @@ function debug_average_models_with_annotations(
mesh!(ax_prewarp, straight_mesh; colorrange, color = straight_color, transparency = true, alpha = 0.1)
meshscatter!(ax_prewarp, straight_seam_cells; markersize = 1.0, color = :gray, alpha = 1)
meshscatter!(ax_prewarp, straight_annotation_cells; markersize = 1.0, color = use_myuntwist ? :gold : :blue, alpha = 1)
text!(ax_prewarp, straight_seam_cell_labels; text = [model.names[1:2:end]; replace.(model.names[1:2:end], 'L' => 'R')], align = (:right, :bottom))
text!(ax_prewarp, straight_seam_cell_labels; text = [replace.(model.names[1:2:end], 'L' => 'R'); model.names[1:2:end]], align = (:right, :bottom))
ann_txt = text!(ax_prewarp, straight_annotation_cells; text = straight_annotation_text, align = (:right, :bottom))
connect!(ann_txt.visible, annotation_text_toggle.active)
#lines!(ax_prewarp, _lines, color = :black)
ylims!(ax_prewarp, (0, 200))

twisted_seam_cell_text = Observable(String.([tmodel.names[1:2:end]; tmodel.names[2:2:end]]))
twisted_seam_cell_text = Observable(String.([tmodel.names[2:2:end]; tmodel.names[1:2:end]]))

mesh!(ax_twisted, twisted_mesh; colorrange, color = twisted_color, transparency = true, alpha = 0.5)
lines!(ax_twisted, twisted_central_spline)
Expand Down Expand Up @@ -311,7 +313,7 @@ function debug_average_models_with_annotations(
x -> begin
nt = x * (length(_range) - 1) + 1.0
nt = round(Int, nt)
title_twisted[] = "Twisted; idx = $nt, tp = $(range[nt])"
title_twisted[] = "Twisted; idx = $nt, tp = $(_range[nt])"
mts(nt)
end
end
Expand Down Expand Up @@ -425,20 +427,20 @@ function debug_average_models_with_annotations(
mesh!(ax, _mesh; colorrange, color = _color, transparency = true, alpha = 0.1)
meshscatter!(ax, _seam_cells; markersize = 1.0, color = :gray, alpha = 1)
meshscatter!(ax, _annotation_cells; markersize = 1.0, color = use_myuntwist ? :gold : :blue, alpha = 1)
text!(ax, _seam_cell_labels; text = [model.names[1:2:end]; replace.(model.names[1:2:end], 'L' => 'R')], align = (:right, :bottom))
text!(ax, _seam_cell_labels; text = [replace.(model.names[1:2:end], 'L' => 'R'); model.names[1:2:end]], align = (:right, :bottom))
text!(ax, _annotation_cells; text = _annotation_text, align = (:right, :bottom))
#lines!(ax, _lines, color = :black)
ylims!(ax, (0, 200))

mesh!(ax_prewarp, straight_mesh; colorrange, color = straight_color, transparency = true, alpha = 0.1)
meshscatter!(ax_prewarp, straight_seam_cells; markersize = 1.0, color = :gray, alpha = 1)
meshscatter!(ax_prewarp, straight_annotation_cells; markersize = 1.0, color = use_myuntwist ? :gold : :blue, alpha = 1)
text!(ax_prewarp, straight_seam_cell_labels; text = [model.names[1:2:end]; replace.(model.names[1:2:end], 'L' => 'R')], align = (:right, :bottom))
text!(ax_prewarp, straight_seam_cell_labels; text = [replace.(model.names[1:2:end], 'L' => 'R'); model.names[1:2:end]], align = (:right, :bottom))
text!(ax_prewarp, straight_annotation_cells; text = straight_annotation_text, align = (:right, :bottom))
#lines!(ax_prewarp, _lines, color = :black)
ylims!(ax_prewarp, (0, 200))

twisted_seam_cell_text = Observable([tmodel.names[1:2:end]; tmodel.names[2:2:end]])
twisted_seam_cell_text = Observable([tmodel.names[2:2:end]; tmodel.names[1:2:end]])

mesh!(ax_twisted, twisted_mesh; colorrange, color = twisted_color, transparency = true, alpha = 0.5)
meshscatter!(ax_twisted, twisted_seam_cells; markersize = 1.0, color = :gray, alpha = 0.5, transparency = true)
Expand All @@ -462,7 +464,7 @@ function debug_average_models_with_annotations(
x -> begin
nt = x * (_length - 1) + 1.0
nt = round(Int, nt)
title_twisted[] = "Twisted; idx = $nt"
title_twisted[] = "Twisted; idx = $nt, tp = $(_range[nt])"
mts(nt)
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/demo_averaging/show_average_annotations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function show_average_annotations(

model = avg_models[end]

seam_cell_text = [model.names[1:2:end]; replace.(model.names[1:2:end], 'L' => 'R')]
seam_cell_text = [replace.(model.names[1:2:end], 'L' => 'R'); model.names[1:2:end]]
menu_options[] = [common_annotations; seam_cell_text]

_mesh = Observable(ShroffCelegansModels.get_model_contour_mesh(model; transform_points=swapyz_scale))
Expand Down
2 changes: 1 addition & 1 deletion src/symposium_poster_2024.jl
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ function poster_average_models_with_annotations(
mesh!(ax, _mesh; colorrange, color = _color, transparency = true, alpha = 0.1)
meshscatter!(ax, _seam_cells; markersize = 1.0, color = :gray, alpha = 1)
meshscatter!(ax, _annotation_cells; markersize = 1.0, color = use_myuntwist ? :gold : :blue, alpha = 1)
text!(ax, _seam_cell_labels; text = [model.names[1:2:end]; replace.(model.names[1:2:end], 'L' => 'R')], align = (:right, :bottom))
text!(ax, _seam_cell_labels; text = [replace.(model.names[1:2:end], 'L' => 'R'); model.names[1:2:end]], align = (:right, :bottom))
text!(ax, _annotation_cells; text = _annotation_text, align = (:right, :bottom), visible = false)
#lines!(ax, _lines, color = :black)
ylims!(ax, (0, 200))
Expand Down

0 comments on commit 71ec0d1

Please sign in to comment.