Hi, I am trying to open a multichannel image in Napari, after turning it into a numpy array via pyimagej. I have a CZI file of a confocal stacks with six channels, no time dimensions. After running
ij.py.from_java I get
('z', 'Channel', 'y', 'x') and
(33, 6, 225, 512).
Now, I want to run
viewer.add_image(image, channel_axis=1) to separate each channel in a new image layer.
Instead, I get
ValueError: dimensions ('z', 'Channel', 'y', 'x') must have the same length as the number of data dimensions, ndim=3.
How should I proceed? Do I need to swap the dimensions of my image so channel is the first one? I remember Numpy array and ImageJ don’t have the same order of dimensions.
import napari import imagej ij = imagej.init('sc.fiji:fiji:2.1.1') viewer = napari.Viewer() dataset = ij.io().open("Image 27.czi") image = ij.py.from_java(dataset) viewer.add_image(image, channel_axis=1) # buggy line ij.getContext().dispose() napari.run()