Open XDevos opened 8 months ago
Found a solution for stack with multiple frames that are not detected as 3D images by io.imread (skimage) or imread (tifffile) :
from skimage import io
from tifffile import imread, imwrite
import numpy as np
from tifffile import TiffFile
# Number of channels in stack
c = 3
path_stack = "/mnt/grey/DATA/rawData_2024/Experiment_4_Marion_RNA-FISH_DNA-FISH_rut/rep_1/rut_intron_WF/tiff/"
for n in range(20, 39): # Adjust the range accordingly
if n < 10:
filename = "00" + str(n)
else:
filename = "0" + str(n)
im_coll = io.ImageCollection(f"{path_stack}scan_001_DAPI_{filename}_ROI.tif")
stack = io.concatenate_images(im_coll)
stack_RNA = stack[2::c] # Extracting the third channel
imwrite(f"/mnt/grey/DATA/ProcessedData_2024/Experiment_4_Marion_RNA-FISH_DNA-FISH_rut/rep_1/Raw_RNA-FISH/scan_001_DAPI_{filename}_ROI_converted_decon_ch02.tif", stack_RNA)
For skimage we need:
Or, for PILLOW: