Skip to content
Snippets Groups Projects
Commit 9e073acf authored by François  LAURENT's avatar François LAURENT
Browse files

interpolate can handle all sorts of labels

parent c7d09aac
No related branches found
No related tags found
3 merge requests!6Set of commits to be tagged v0.16,!5Experimental support for MaggotUBA's larva_dataset hdf5 files,!4samplesize! for ratiobasedsampling
Pipeline #110378 passed
......@@ -76,7 +76,7 @@ interpolate(x1::T, x2::T, lambda) where {T<:AbstractFloat} = (1 - lambda) * x1 +
interpolate(x1::T,
x2::T,
lambda,
) where {T<:AbstractArray} = @. (1 - lambda) * x1 + lambda * x2
) where {T<:AbstractArray{<:AbstractFloat}} = @. (1 - lambda) * x1 + lambda * x2
function interpolate(geometry1::T, geometry2::T, lambda) where {T<:Larva.SpineGeometry}
x1, y1 = collect.(zip(coordinates.(Larva.vertices′(geometry1))...))
x2, y2 = collect.(zip(coordinates.(Larva.vertices′(geometry2))...))
......@@ -84,7 +84,8 @@ function interpolate(geometry1::T, geometry2::T, lambda) where {T<:Larva.SpineGe
Larva.PointSeries(interpolate(x1, x2, lambda),
interpolate(y1, y2, lambda)))
end
function interpolate(tags1::T, tags2::T, lambda) where {T<:Larva.AbstractTags}
function interpolate(tags1, tags2, lambda)
# default nearest-neighbor implementation for tags/labels
lambda <= 0.5 ? tags1 : tags2
end
function interpolate(state1::T, state2::T, lambda) where {T<:NamedTuple}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment