python复制nii文件
import os
import shutil
# 获取当前工作目录
current_directory = os.getcwd()
# 创建目标文件夹路径
PathPlanning = os.path.join(current_directory, 'PathPlanning')
os.makedirs(PathPlanning, exist_ok=True) #路径不存在则创建
# 源文件路径
output_path = 'path_to_output'
skinBorderPath = os.path.join(output_path, "input.nii")
# 目标文件路径
targetSkinBorderPath = os.path.join(PathPlanning, "input1.nii")
# 复制文件
shutil.copy(skinBorderPath, targetSkinBorderPath)
print(f"文件已成功复制到 {targetSkinBorderPath}")