[Python] Converting 2d tiff into 3d tif files - stack error

Discussão em 'Python' iniciado por Stack, Setembro 17, 2025.

  1. Stack

    Stack Membro Participativo

    I'm working in WSL Ubuntu, writing this script in SPAM Jupyter Lab. I want to convert my 2d TIFF files into a 3d TIFF file. After stating the directory where the 2d TIFF files are, this is my code:

    files = sorted([f for f in os.listdir(folder) if f.endswith(".tiff")])
    files = sorted([f for f in os.listdir(folder) if f.endswith(".tiff")])
    stack = []
    for fname in files:
    img = tifffile.imread(os.path.join(folder, fname))
    stack.append(img)

    volume = np.stack(stack, axis=0)


    I get an error message: need at least one array to stack. I don't know how to correct it. Can you please help?

    Continue reading...

Compartilhe esta Página