【发布时间】:2019-12-11 02:53:56
【问题描述】:
a seg img A - 3d numpy 数组图像,形状 (150, 418, 406),仅包含两个值 0, 1
调整大小的 img B - 上述调整大小的版本 (160, 192, 128),许多数组值 [-0.26 ~ 1.28]
调整大小的过程是由这段代码运行的:
def resize(img, shape, mode='constant', orig_shape=None):
"""
Wrapper for scipy.ndimage.zoom suited for MRI images.
"""
if orig_shape == None: orig_shape = img.shape
assert len(shape) == 3, "Can not have more than 3 dimensions"
factors = (
shape[0]/orig_shape[0],
shape[1]/orig_shape[1],
shape[2]/orig_shape[2]
)
# Resize to the given shape
return zoom(img, factors, mode=mode)
下面的图像是每个 3d 图像的第 80 个切片。 (A, B)
我只想对 mri 分割图像进行下采样,不想对图像进行奇怪的修改。任何帮助,将不胜感激。
【问题讨论】:
标签: python multidimensional-array scipy