rtmri_seg_v3.zip:MATLAB开发的声道参数自动提取工具

需积分: 5 0 下载量 60 浏览量 更新于2024-11-19 收藏 1.15MB ZIP 举报
资源摘要信息:"rtmri_seg_v3.zip是基于网格线的自动声道参数提取工具,该工具采用matlab语言开发,主要用于在中矢状面的上呼吸道图像中稳健地提取声道参数。该工具的开发目的是为了解决在使用实时磁共振成像(rtMRI)记录的声道图像进行分析时,手动提取声道参数工作量大,效率低下的问题。 该工具的主要功能包括图像增强、基于用户手动选择的地标点的半自动网格线构建、自动追踪嘴唇最前缘和喉头(杓状肌)、声道壁内口腔咽气道路径的自动估计、声道内气道-组织边界的自动分割和计算上下边界之间的距离函数等。 首先,图像增强环节包括场敏校正和抑制颗粒状噪声,主要目的是增加组织与气道的对比度,以便更准确地识别和提取声道参数。接着,用户需要手动选择4个地标点,然后软件将根据这些地标点构建半自动网格线,这个过程是基于用户输入的数据进行计算的,可以大大提高声道参数提取的准确性。 软件还可以自动追踪嘴唇最前缘和喉头(杓状肌),这对于分析声道的运动模式和动态特征非常重要。此外,软件还能自动估计声道壁内口腔咽气道路径,这有助于我们理解声道的结构和功能。声道内气道-组织边界的自动分割功能,可以准确地识别声道内气道和组织的边界,这将有助于我们更准确地计算声道的体积和面积等参数。 最后,软件可以计算上下边界之间的距离函数,这对于理解声道的运动范围和动态特性非常重要。所有的这些功能,使得rtmri_seg_v3.zip成为一个强大的工具,它不仅提高了声道参数提取的效率,而且提高了提取的准确性。 开发者希望用户在使用该软件时,能引用Jangwon Kim、Naveen Kumar、Sungbok Lee 和 Shrikanth Narayanan在2014年国际语音生成研讨会(ISSP)上发表的论文,该论文详细介绍了该软件的开发背景、原理和方法。 总的来说,rtmri_seg_v3.zip是基于网格线的自动声道参数提取工具,通过MATLAB语言开发,可以有效地解决实时磁共振成像(rtMRI)记录的声道图像分析中声道参数提取的难题。它具有图像增强、半自动网格线构建、自动追踪、自动估计、自动分割和距离函数计算等功能,大大提高了声道参数提取的效率和准确性。"
2023-07-15 上传

解释每一行代码import os import numpy as np import nibabel as nib import imageio import cv2 def read_niifile(niifilepath): # 读取niifile文件 img = nib.load(niifilepath) # 提取niifile文件 img_fdata = img.get_fdata(dtype='float32') return img_fdata def save_fig(niifilepath, savepath, num, name): # 保存为图片 name = name.split('-')[1] filepath_seg = niifilepath + "segmentation\\" + "segmentation-" + name filepath_vol = niifilepath + "volume\\" + "volume-" +name savepath_seg = savepath + "segmentation\\" savepath_vol = savepath + "volume\\" if not os.path.exists(savepath_seg): os.makedirs(savepath_seg) if not os.path.exists(savepath_vol): os.makedirs(savepath_vol) fdata_vol = read_niifile(filepath_vol) fdata_seg = read_niifile(filepath_seg) (x, y, z) = fdata_seg.shape total = x * y for k in range(z): silce_seg = fdata_seg[:, :, k] # 三个位置表示三个不同角度的切片 if silce_seg.max() == 0: continue else: silce_seg = (silce_seg-silce_seg.min())/(silce_seg.max() - silce_seg.min())*255 silce_seg = cv2.threshold(silce_seg, 1, 255, cv2.THRESH_BINARY)[1] if (np.sum(silce_seg == 255) / total) > 0.015: silce_vol = fdata_vol[:, :, k] silce_vol = (silce_vol - silce_vol.min()) / (silce_vol.max() - silce_vol.min()) * 255 imageio.imwrite(os.path.join(savepath_seg, '{}.png'.format(num)), silce_seg) imageio.imwrite(os.path.join(savepath_vol, '{}.png'.format(num)), silce_vol) num += 1 # 将切片信息保存为png格式 return num if __name__ == '__main__': path= 'E:\\dataset\\LiTS17\\' savepath = 'E:\\dataset\\LiTS17\\2d\\' filenames = os.listdir(path + "segmentation") num = 0 for filename in filenames: num = save_fig(path, savepath, num, filename)

2023-05-25 上传

此代码import os import numpy as np import nibabel as nib import imageio from PIL import Image def read_niifile(niifilepath): # 读取niifile文件 img = nib.load(niifilepath) # 提取niifile文件 img_fdata = img.get_fdata(dtype='float32') return img_fdata def save_fig(niifilepath, savepath, num, name): # 保存为图片 name = name.split('-')[1] filepath_seg = niifilepath + "segmentation\\" + "segmentation-" + name filepath_vol = niifilepath + "volume\\" + "volume-" + name savepath_seg = savepath + "segmentation\\" savepath_vol = savepath + "volume\\" if not os.path.exists(savepath_seg): os.makedirs(savepath_seg) if not os.path.exists(savepath_vol): os.makedirs(savepath_vol) fdata_vol = read_niifile(filepath_vol) fdata_seg = read_niifile(filepath_seg) (x, y, z) = fdata_seg.shape total = x * y for k in range(z): silce_seg = fdata_seg[:, :, k] if silce_seg.max() == 0: continue else: silce_seg = (silce_seg - silce_seg.min()) / (silce_seg.max() - silce_seg.min()) * 255 silce_seg = np.uint8(Image.fromarray(silce_seg).convert('L')) silce_seg = cv2.threshold(silce_seg, 1, 255, cv2.THRESH_BINARY)[1] if (np.sum(silce_seg == 255) / total) > 0.015: silce_vol = fdata_vol[:, :, k] silce_vol = (silce_vol - silce_vol.min()) / (silce_vol.max() - silce_vol.min()) * 255 silce_vol = np.uint8(Image.fromarray(silce_vol).convert('L')) imageio.imwrite(os.path.join(savepath_seg, '{}.png'.format(num)), silce_seg) imageio.imwrite(os.path.join(savepath_vol, '{}.png'.format(num)), silce_vol) num += 1 return num if __name__ == '__main__': path = 'C:\Users\Administrator\Desktop\LiTS2017' savepath = 'C:\Users\Administrator\Desktop\2D-LiTS2017' filenames = os.listdir(path + "segmentation") num = 0 for filename in filenames: num = save_fig(path, savepath, num, filename)出现SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape,请修改它,给出完整代码

2023-05-25 上传

import os import numpy as np import nibabel as nib import imageio import cv2 def read_niifile(niifilepath): # 读取niifile文件 img = nib.load(niifilepath) # 提取niifile文件 img_fdata = img.get_fdata(dtype='float32') return img_fdata def save_fig(niifilepath, savepath, num, name): # 保存为图片 name = name.split('-')[1] filepath_seg = niifilepath + "segmentation\\" + "segmentation-" + name filepath_vol = niifilepath + "volume\\" + "volume-" + name savepath_seg = savepath + "segmentation\\" savepath_vol = savepath + "volume\\" if not os.path.exists(savepath_seg): os.makedirs(savepath_seg) if not os.path.exists(savepath_vol): os.makedirs(savepath_vol) fdata_vol = read_niifile(filepath_vol) fdata_seg = read_niifile(filepath_seg) (x, y, z) = fdata_seg.shape total = x * y for k in range(z): silce_seg = fdata_seg[:, :, k] # 三个位置表示三个不同角度的切片 if silce_seg.max() == 0: continue else: silce_seg = (silce_seg - silce_seg.min()) / (silce_seg.max() - silce_seg.min()) * 255 silce_seg = cv2.threshold(silce_seg, 1, 255, cv2.THRESH_BINARY)[1] if (np.sum(silce_seg == 255) / total) > 0.015: silce_vol = fdata_vol[:, :, k] silce_vol = (silce_vol - silce_vol.min()) / (silce_vol.max() - silce_vol.min()) * 255 imageio.imwrite(os.path.join(savepath_seg, '{}.png'.format(num)), silce_seg) imageio.imwrite(os.path.join(savepath_vol, '{}.png'.format(num)), silce_vol) num += 1 # 将切片信息保存为png格式 return num if __name__ == '__main__': path = r"C:\Users\Administrator\Desktop\LiTS2017" savepath = r"C:\Users\Administrator\Desktop\2D-LiTS2017" filenames = os.listdir(path + "segmentation") num = 0 for filename in filenames: num = save_fig(path, savepath, num, filename)替换掉代码中的cv2模块,实现相同功能

2023-05-25 上传

import os import numpy as np import nibabel as nib import imageio import cv2 def read_niifile(niifilepath): # 读取niifile文件 img = nib.load(niifilepath) # 提取niifile文件 img_fdata = img.get_fdata(dtype='float32') return img_fdata def save_fig(niifilepath, savepath, num, name): # 保存为图片 name = name.split('-')[1] filepath_seg = niifilepath + "segmentation\" + "segmentation-" + name filepath_vol = niifilepath + "volume\" + "volume-" + name savepath_seg = savepath + "segmentation\" savepath_vol = savepath + "volume\" if not os.path.exists(savepath_seg): os.makedirs(savepath_seg) if not os.path.exists(savepath_vol): os.makedirs(savepath_vol) fdata_vol = read_niifile(filepath_vol) fdata_seg = read_niifile(filepath_seg) (x, y, z) = fdata_seg.shape total = x * y for k in range(z): silce_seg = fdata_seg[:, :, k] # 三个位置表示三个不同角度的切片 if silce_seg.max() == 0: continue else: silce_seg = (silce_seg - silce_seg.min()) / (silce_seg.max() - silce_seg.min()) * 255 silce_seg = cv2.threshold(silce_seg, 1, 255, cv2.THRESH_BINARY)[1] if (np.sum(silce_seg == 255) / total) > 0.015: silce_vol = fdata_vol[:, :, k] silce_vol = (silce_vol - silce_vol.min()) / (silce_vol.max() - silce_vol.min()) * 255 imageio.imwrite(os.path.join(savepath_seg, '{}.png'.format(num)), silce_seg) imageio.imwrite(os.path.join(savepath_vol, '{}.png'.format(num)), silce_vol) num += 1 # 将切片信息保存为png格式 return num if name == 'main': path = r"C:\Users\Administrator\Desktop\LiTS2017" savepath = r"C:\Users\Administrator\Desktop\2D-LiTS2017" filenames = os.listdir(path + "segmentation") num = 0 for filename in filenames: num = save_fig(path, savepath, num, filename) 替换掉代码中的cv2模块,实现相同功能

2023-05-25 上传