mask = sitk.ReadImage(mask_path) # type: sitk.Image
# mask.SetDirection((1,0,0,0,-1,0,0,0,1))
mask = sitk.Flip(mask, sitk.VectorBool([False,True,False])) #沿y轴翻转
output_path = os.path.join(os.getcwd(), 'test_direction.nii')
sitk.WriteImage(mask, output_path)
网友评论