Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有大小为 [284,143,143] 的 3D 体积医学图像。我想从中提取轴向切片并将它们单独保存在一个文件夹中。谁能告诉我如何在 python 中实现这一点。
我不确定这是否是您要查找的内容,但您始终可以在索引时使用 numpy 和 slice。(由于标签,我假设您的图像是 PIL 图像)
import numpy as np from PIL import Image ...` arr = np.array(PIL_Image) for i in range(284): slice = Image.fromarray(arr[i, :, :]) slice.save(f"slice{i}.jpg")