I am working on a code that would take my tif file of dimension [5,1024,1024,3] to reorder it to produce dimension of [5, 3, 1024, 1024]. [5,1024,1024,3] shows the dimension of [nplane x nY x nX x nchannels]. The goal is to get [nplane x nchannels x nY x nX ] or [5, 3, 1024, 1024] I am not sure what is the problem. The resized_data
gives the correct dimension [5, 3, 1024, 1024].
import skimage.io
import numpy as np
from skimage.transform import resize
from tifffile import imread, imwrite, imsave
from numpy import savetxt
data = skimage.io.imread('stack.tif')
print(data.shape)
# resizing file
resized_data = np.reshape(data, (5, 3, 1024, 1024))
print(resized_data.shape)
imwrite('resized_stack.tif', resized_data)