Closed li-pengcheng closed 5 years ago
我做了如下修改,结果奏效了:)
# image = sub_srcimages[j, z, :, :]
# image = image.astype(np.float32)
# image = np.clip(image, 0, 255).astype('uint8')
# cv2.imwrite(filepath + str(z) + ".bmp", image)
# cv2.imwrite(filepath2 + str(z) + ".bmp", sub_masks[j, z, :, :])
image = sub_srcimages[j, :, :, :]
image = sitk.GetImageFromArray(image)
mask = sub_masks[j,:,:,:]
mask = sitk.GetImageFromArray(mask)
sitk.WriteImage(image, filepath + 'img_patch.nii')
sitk.WriteImage(mask, filepath2 + 'gt_patch.nii')
请教一下,在函数gen_image_mask中,您保存的是16张256×256的图片,我是否可以将这16幅图保存为一个nii文件呢?具体应该怎么操作?谢谢