Description
Numpy and matplotlib have limited axis handling capabilities when it comes to plotting. There is no way to specify a custom axis, such as XYCT vs XYTC, except by manually plotting it with foreknowledge of the axis.
In addition, numpy indexing is in row-major form (ZYX) which is reversed from Java (XYZ). However, as an exception, python plotting libraries assume that the image is RGB if the last channel is 3-dimensional. E.g. YXC or ZYXC. This complicates conversion back and forth between ImageJ and Numpy, as ImageJ opens RGB as XYZC, and so you can't simply reverse the axis order if you want to make the numpy image directly plotable.
The pyimagej conversion functions from_java
and to_java
should have some way of specifying channel conventions, and the view
function should plot that convention correctly. This is particularly important in cases where ops/filters alter the axis order, which can quickly cause unintended errors.
@ctrueden suggests some form of hint
variable or other way of passing through Metadata, but the implementation and edge-case handling needs to be determined.