From bcaf598335513a37cd3ebc676402a2b4004d33df Mon Sep 17 00:00:00 2001 From: Tokazama Date: Mon, 16 Sep 2019 08:16:13 -0400 Subject: [PATCH] Making AxisArrays compatible with new core traits. --- src/ImageAxes.jl | 4 ++++ test/runtests.jl | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/ImageAxes.jl b/src/ImageAxes.jl index c13b307..ac04ddd 100644 --- a/src/ImageAxes.jl +++ b/src/ImageAxes.jl @@ -27,6 +27,10 @@ export # types timeaxis, timedim +ImageCore.HasDimNames(::Type{A}) where {A<:AxisArray} = HasDimNames{true}() +ImageCore.namedaxes(a::AxisArray) = NamedTuple{axisnames(a)}(axisvalues(a)) +Base.names(a::AxisArray) = axisnames(a) + """ TimeAxis{Ax} diff --git a/test/runtests.jl b/test/runtests.jl index 5484c10..99ee04f 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -145,6 +145,8 @@ end @test @inferred(size_spatial(M)) == (5, 4) assert_timedim_last(P) @test_throws ErrorException assert_timedim_last(M) + @test @inferred(HasDimNames(A)) == HasDimNames{true}() + @test @inferred(namedaxes(A)) == NamedTuple{axisnames(A)}(axisvalues(A)) end # Possibly-ambiguous functions