How to save 4D Tiff for ImageJ using Python?

tiff
Tags: #<Tag:0x00007fd542c61ac8>

#1

Hi, I have a bunch of PNG images and I’m trying to create a 4D Tiff file that is interpreted in ImageJ as a 3D time series. I started out with this guide, but in that case, 4D Tiffs are interpreted as having multiple channels, not time steps. Looking at the metadata of a Tiff I created with ImageJ, I noticed that timesteps are called ‘frames’ there. So I changed the metadata from

_imagej_metadata = """ImageJ=1.47a
images={nr_images}
channels={nr_channels}
slices={nr_slices}
hyperstack=true
mode=color
loop=false"""

(as shown in the guide) to

_imagej_metadata = """ImageJ=1.47a
images={nr_images}
channels={nr_channels}
slices={nr_slices}
hyperstack=true
mode=color
loop=false"""

This gets me closer to what I want; ImageJ now shows a time slider instead of a channel slider. However, the images are shown in false order. Moving the time slider jumps between two z-positions, and moving the z-slider seems to jump between both time steps and z-positions. Does the hyperstack-array need to have a different shape?


#2

Dear @speedymcs,

I am not entirely sure, but I guess ImageJ assumes XYCZT order per default when reading TIFFs. For your case that should be:

XYZ1T1
XYZ2T1
XYZ3T1
...
XYZ1T2
XYZ2T2
...
XYZnTn

Best,
Stefan