Is there an easy way to iterate over all axes except certain ones? I.e. the negation of the inputs? My use case is a general function that works on images with an arbitrary number of dimensions, but needs to iterate over all XY slices.
Here’s a super clunky way that I just whipped up to show what I was generally thinking:
using AxisArrays
# this is given to us and the axis number/order is not guaranteed
mat = AxisArray(rand(10, 10, 3, 10), :x, :y, :channel, :time);
all_axs = Set(axisnames(mat))
pop!(all_axs, :x)
pop!(all_axs, :y)
axs = collect(all_axs)
for I in CartesianIndices(Tuple(size(mat, Axis{ax}) for ax in axs))
println(collect(Axis{ax}(I[i]) for (i, ax) in enumerate(axs)))
end
What’s a better way to accomplish this?