I am writing a script in python to crop out several rois from a huge czi file (with different channels and timepoints) to then rescale it and do some processing. I usually use fiji to do this, but for several reasons I prefer in this case to do all in python. So, I need two advices:
- I open the czi file using czifile and I crop by slicing it. I then save the file as a tif, but when I open the file in fiji all timepoints and z stacks are fused together. Is there a way to save it in a way that can be read by fiji as multichannel, multi z stack ?
img = czifile.imread('path/to/file.czi') # img.shape is [1, 1, 1, 183, 2, 190, 960, 960, 1] for a file having : # 2 channels, 183 timepoints, 190 slices and 960 pixels in xy # i am not sure about the other numbers resized = img[:, :, :, :, :, 20:40, 106:300, 625:840, :] imsave('crop.tif', resized)
- When I downscale my images in fiji, in the macro I write that I want to downscale by a factor of e.g. 0.5 in xy, no interpolation and averaging when downscaling. Does anybody know how I can reproduce the same output using opencv.resize or skimage.transform or another function?