当前位置: 首页 > news >正文

企业信息系统公示沈阳网络seo公司

企业信息系统公示,沈阳网络seo公司,南京app开发,wordpress如何备份数据库结构【Segment Anything Model】做分割的专栏链接,欢迎来学习。 【博主微信】cvxiayixiao 本专栏为公开数据集的介绍和预处理,持续更新中。 要是只想把Promise12数据集的raw形式分割为png形式,快速导航,直接看2,4标题即可 …

【Segment Anything Model】做分割的专栏链接,欢迎来学习。
【博主微信】cvxiayixiao
本专栏为公开数据集的介绍和预处理,持续更新中。

要是只想把Promise12数据集的raw形式分割为png形式,快速导航,直接看2,4标题即可
这里只处理了test 换个路径在走一边train就行 是一样的

文章目录

  • 1️⃣Promise12数据集介绍
    • 🌵介绍
    • 🌿临床意义
    • 🌱Promise12数据集特点
    • 🍃源文件样图
  • 2️⃣下载Promise12数据集
  • 3️⃣python读取一张Promise12数据集并展示
    • 🍀使用 Python 的 zipfile 模块来访问 ZIP 文件
    • 🍃注意 ⚠️ ⚠️⚠️
    • 🌳提取第一个raw
    • 🌲python读取raw
    • 🌱python读取分割切片结果
  • 4️⃣python处理整个Promise12数据集
    • 1. 数据集下载到本地之后先将zip解压
    • 2. 处理解压之后的数据集,将raw转为png
    • 3. 将所有png图像分为image文件夹和label文件夹
  • 5️⃣Promise12数据集官方给的评价指标

1️⃣Promise12数据集介绍

🌵介绍

数据集来源一个比赛Prostate MR Image Segmentation 2012。是一个广泛用于前列腺磁共振成像(MRI)分割的数据集。
这个数据集最初是在2012年的MICCAI 'Prostate MR Image Segmentation’挑战赛中使用的,🚩目标是比较用于前列腺MRI的交互式和(半)自动分割算法。可以下载。官网 下载地址在 Download里面

🌿临床意义

前列腺在MR图像上的分割在临床上尤为重要,👀因为它可以帮助确定前列腺的体积,这对于评估前列腺疾病,预测前列腺癌的病理阶段,了解预后,并帮助预测治疗反应都极为重要。

前列腺的大小,形状,以及相对于相邻器官的位置的信息是进行前列腺切除手术,🗿放射治疗以及新兴的微创疗法(如冷冻治疗和高强度聚焦超声)的手术规划的重要组成部分。Promise12数据集可以为这些应用提供关键的、精确的前列腺分割信息🚩。

🌱Promise12数据集特点

这个数据集的特点包括:

多中心,多数据供应商: 数据集中的图像来自多个不同的医疗中心和机构,使其可以覆盖和代表各种不同的病例和设备来源。

训练和测试数据:数据集提供训练和测试数据,均有相应的真实分割(ground truth)作为参考。

算法比较和评估:提交的结果会被自动评估并与参考标准进行比较,从而可以直观地比较和评价不同的分割算法的性能。

🍎🍎🍎这些特性使Promise12成为了前列腺MRI分割任务的重要基准数据集。研究者通过使用这个数据集来训练并评估他们的前列腺分割算法。

🍃源文件样图

在这里插入图片描述

2️⃣下载Promise12数据集

官网有三个包可以下载
在这里插入图片描述
livechallenge_test_data中的结构如下。这是比赛之后官网验证的数据集,比赛中不可见,是测试部分。
每个样本由4个文件组成分别是原始img的mhd,分割img的mhd。原始img的raw 分割img的raw

MHD和RAW是常用于医学图像处理和存储的文件格式。
MHD用于存储医学图像数据和相关的元数据信息。MHD文件通常是一个文本文件,其中包含图像数据的描述信息,例如图像的维度、像素类型、像素间距、数据存储顺序等。MHD文件本身并不包含图像数据,而是引用一个相应的RAW文件来存储实际的图像数据RAW文件则是包含原始图像数据的二进制文件。它通常与MHD文件配套使用,用于存储实际的图像像素值。RAW文件中的数据可以是未经处理的原始像素值,例如灰度值或颜色值,具体取决于图像的类型和采集设备。

在这里插入图片描述
test_data是提供给参赛人员的测试样本,结构一样。
在这里插入图片描述
training_data训练数据,也一样
在这里插入图片描述

3️⃣python读取一张Promise12数据集并展示

🍀使用 Python 的 zipfile 模块来访问 ZIP 文件

import zipfile
import os
import SimpleITK as sitk
import matplotlib.pyplot as plt
# 设置文件的路径
zip_file_path = 'F:\BaiduNetdiskDownload\promise12\\test_data.zip'
#
# 检查文件是否存在
if os.path.exists(zip_file_path):with zipfile.ZipFile(zip_file_path, 'r') as zip_ref:# 获取 ZIP 文件中的文件列表file_list = zip_ref.namelist()# 选取第一个文件(或任意一个文件)作为样本来展示sample_file = file_list[0] if file_list else None# 如果找到样本文件,则读取并展示其内容if sample_file:# 提取样本文件到当前目录或其他指定目录zip_ref.extract(sample_file, './extract/')print(f"样本文件 '{sample_file}' 已提取。")else:print("ZIP 文件中没有找到任何文件。")
else:print(f"文件路径 '{zip_file_path}' 不存在。")

运行结果为在这里插入图片描述
打开mhd文件,就是此图像的成像描述
在这里插入图片描述

🍃注意 ⚠️ ⚠️⚠️

文件关联问题:.mhd 文件应包含指向 .raw 文件的引用。也就是上图中的最后一行
一定确保 .mhd 文件中的路径指向 .raw 文件是正确的,并且 .raw 文件位于指定的位置。一定确保同时有 .mhd 和 .raw 文件。

🌳提取第一个raw

刚才的代码提取了第一个mhd文件,为了保证文件关联性,mhd 文件要指向 .raw 文件的引用。所以现在提取第一个raw文件,才能展示出图像。
上面代码这个改成1就好了
在这里插入图片描述
此代码的运行效果就是 提取到了mhd和raw到同一文件夹里面
在这里插入图片描述

🌲python读取raw

虽说图像信息保存在了raw里面,但其实读取的是mhd文件,mhd文件里面有raw文件的引用
读取代码如下

import zipfile
import os
import SimpleITK as sitk
import matplotlib.pyplot as plt
# 设置文件的路径
zip_file_path = 'F:\BaiduNetdiskDownload\promise12\\test_data.zip'
#
# 检查文件是否存在
if os.path.exists(zip_file_path):with zipfile.ZipFile(zip_file_path, 'r') as zip_ref:# 获取 ZIP 文件中的文件列表file_list = zip_ref.namelist()# 选取第一个文件(或任意一个文件)作为样本来展示sample_file = file_list[1] if file_list else None# 如果找到样本文件,则读取并展示其内容if sample_file:# 提取样本文件到当前目录或其他指定目录image_file = './extract/' + sample_filezip_ref.extract(sample_file, './extract/')image = sitk.ReadImage('./extract/Case00.mhd')# 将 SimpleITK 图像转换为 NumPy 数组image_array = sitk.GetArrayFromImage(image)# 选择一个切片来展示slice_index = 0  # 你可以选择不同的切片索引selected_slice = image_array[slice_index]# 使用 matplotlib 展示图像切片plt.imshow(selected_slice, cmap='gray')plt.axis('off')  # 不显示坐标轴plt.show()print(f"样本文件 '{sample_file}' 已提取。")else:print("ZIP 文件中没有找到任何文件。")
else:print(f"文件路径 '{zip_file_path}' 不存在。")

效果如下
在这里插入图片描述

🌱python读取分割切片结果

先用 Python 的 zipfile 模块来访问 ZIP 文件的代码把3,4切片的mhd和raw读取到extract文件夹里面
这个过程和第一个代码一样,就是改一下数字

import zipfile
import os
import SimpleITK as sitk
import matplotlib.pyplot as plt
# 设置文件的路径
zip_file_path = 'F:\BaiduNetdiskDownload\promise12\\test_data.zip'
#
# 检查文件是否存在
if os.path.exists(zip_file_path):with zipfile.ZipFile(zip_file_path, 'r') as zip_ref:# 获取 ZIP 文件中的文件列表file_list = zip_ref.namelist()# 选取第一个文件(或任意一个文件)作为样本来展示sample_file = file_list[3] if file_list else None# 如果找到样本文件,则读取并展示其内容if sample_file:# 提取样本文件到当前目录或其他指定目录zip_ref.extract(sample_file, './extract/')# image = sitk.ReadImage('./extract/Case00_segmentation.mhd')# # 将 SimpleITK 图像转换为 NumPy 数组# image_array = sitk.GetArrayFromImage(image)# # 选择一个切片来展示# slice_index = 9  # 你可以选择不同的切片索引# selected_slice = image_array[slice_index]# # 使用 matplotlib 展示图像切片# plt.imshow(selected_slice, cmap='gray')# plt.axis('off')  # 不显示坐标轴# plt.show()print(f"样本文件 '{sample_file}' 已提取。")else:print("ZIP 文件中没有找到任何文件。")
else:print(f"文件路径 '{zip_file_path}' 不存在。")

sample_file = file_list[3] if file_list else None这一行先改成2在改成3.
这样就能把3,4切片的mhd和raw读取到extract文件夹里面
之后运行下面的代码就能读取到分割结果的切片

import zipfile
import os
import SimpleITK as sitk
import matplotlib.pyplot as plt
# 设置文件的路径
zip_file_path = 'F:\BaiduNetdiskDownload\promise12\\test_data.zip'
#
# 检查文件是否存在
if os.path.exists(zip_file_path):with zipfile.ZipFile(zip_file_path, 'r') as zip_ref:# 获取 ZIP 文件中的文件列表file_list = zip_ref.namelist()# 选取第一个文件(或任意一个文件)作为样本来展示sample_file = file_list[3] if file_list else None# 如果找到样本文件,则读取并展示其内容if sample_file:# 提取样本文件到当前目录或其他指定目录zip_ref.extract(sample_file, './extract/')image = sitk.ReadImage('./extract/Case00_segmentation.mhd')# 将 SimpleITK 图像转换为 NumPy 数组image_array = sitk.GetArrayFromImage(image)# 选择一个切片来展示slice_index = 9  # 你可以选择不同的切片索引selected_slice = image_array[slice_index]# 使用 matplotlib 展示图像切片plt.imshow(selected_slice, cmap='gray')plt.axis('off')  # 不显示坐标轴plt.show()print(f"样本文件 '{sample_file}' 已提取。")else:print("ZIP 文件中没有找到任何文件。")
else:print(f"文件路径 '{zip_file_path}' 不存在。")

在这里插入图片描述

4️⃣python处理整个Promise12数据集

👍👍👍 以上我们完成的是使用python读取到了一张原图和一张分割结果的示例图👉👉👉以下我们要做的是使用python处理数据集把她分为网络接受的图片。这里处理成png

1. 数据集下载到本地之后先将zip解压

import zipfile
import os
import SimpleITK as sitk
import matplotlib.pyplot as plt
# 设置文件的路径
zip_file_path = 'F:\BaiduNetdiskDownload\promise12\\test_data.zip'
#
# 检查文件是否存在
if os.path.exists(zip_file_path):with zipfile.ZipFile(zip_file_path, 'r') as zip_ref:# 获取 ZIP 文件中的文件列表file_list = zip_ref.namelist()# 选取第一个文件(或任意一个文件)作为样本来展示for i in file_list:zip_ref.extract(i, './extract/')

在这里插入图片描述

2. 处理解压之后的数据集,将raw转为png

import SimpleITK as sitk
import numpy as np
import imageio
import osdef convert_raw_to_png(raw_folder, output_folder):for file in os.listdir(raw_folder):if file.endswith(".mhd"):image_path = os.path.join(raw_folder, file)image = sitk.ReadImage(image_path)array = sitk.GetArrayFromImage(image)for i, slice in enumerate(array):slice_min = slice.min()slice_max = slice.max()slice_normalized = ((slice - slice_min) / (slice_max - slice_min) * 255).astype(np.uint8)file=os.path.splitext(file)[0]output_path = os.path.join(output_folder, f"{file}_{i}.png")imageio.imwrite(output_path, slice_normalized)raw_folder = "./extract"
output_folder = "./png_images"
os.makedirs(output_folder, exist_ok=True)
convert_raw_to_png(raw_folder, output_folder)

在这里插入图片描述

3. 将所有png图像分为image文件夹和label文件夹

此时的图像都是混在一起的,一个名字对应一个原图和分割结果,我们把它分开在两个文件夹,更有利于构建dataset和dataloader

先把png_images文件夹里面的segmentation全部复制到label文件夹里面
在将png_images文件里里面的segmentation删除

import shutil
import os
path="./png_images"
new_folder='./label'
os.makedirs(new_folder, exist_ok=True)
for i in os.listdir(path):if "segmentation" in i:ori_seg_path=os.path.join(path,i)seg_path=os.path.join(new_folder,i)# 复制文件shutil.copy2(ori_seg_path, seg_path)# 删除混在一起的os.remove(ori_seg_path)

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

5️⃣Promise12数据集官方给的评价指标

Dice相似系数 (Dice Similarity Coefficient, DSC): 常用评价指标,用于量化分割结果与真实标签之间的重叠度。Dice系数的值范围从0到1,值越高表示分割结果与真实情况的一致性越好。

  • 敏感度 (Sensitivity)真正率 (True Positive Rate, TPR): 衡量了分割算法正确识别出正类(即前列腺组织)的能力。

  • 特异性 (Specificity)真负率 (True Negative Rate, TNR): 评估了分割算法正确识别出负类(即非前列腺组织)的能力。

  • Hausdorff距离 (Hausdorff Distance): 这是一个几何度量,用于衡量预测边界与真实边界之间的最大不一致性。

  • 平均表面距离 (Average Surface Distance, ASD): 用于计算预测边界与真实边界之间的平均距离,也是一个评估分割精度的重要指标。

  • 体积重叠误差 (Volume Overlap Error, VOE): 评估分割体积与真实体积之间的重叠程度。
    在这里插入图片描述


文章转载自:
http://dinncorounceval.ssfq.cn
http://dinncowcc.ssfq.cn
http://dinncoemission.ssfq.cn
http://dinncoadiabat.ssfq.cn
http://dinncoskirt.ssfq.cn
http://dinncotuscan.ssfq.cn
http://dinncoaccidental.ssfq.cn
http://dinncomeandrine.ssfq.cn
http://dinncophysiographer.ssfq.cn
http://dinncoseptuagenarian.ssfq.cn
http://dinncoiconolatry.ssfq.cn
http://dinncodedicatee.ssfq.cn
http://dinncocomitative.ssfq.cn
http://dinncomeemies.ssfq.cn
http://dinncoantipasto.ssfq.cn
http://dinncomastodont.ssfq.cn
http://dinncoleptorrhine.ssfq.cn
http://dinncosalon.ssfq.cn
http://dinncoagronomic.ssfq.cn
http://dinncokeyless.ssfq.cn
http://dinncosomatotherapy.ssfq.cn
http://dinncoinappetent.ssfq.cn
http://dinncobireme.ssfq.cn
http://dinncotenny.ssfq.cn
http://dinncoppb.ssfq.cn
http://dinncojangler.ssfq.cn
http://dinncoasuncion.ssfq.cn
http://dinncohiddenite.ssfq.cn
http://dinncopapalism.ssfq.cn
http://dinncoethal.ssfq.cn
http://dinncoramp.ssfq.cn
http://dinncomonomark.ssfq.cn
http://dinncothermonasty.ssfq.cn
http://dinncotonstein.ssfq.cn
http://dinncobass.ssfq.cn
http://dinncoswanlike.ssfq.cn
http://dinncoreflectometry.ssfq.cn
http://dinncoreverse.ssfq.cn
http://dinncotwp.ssfq.cn
http://dinncoratine.ssfq.cn
http://dinncoschwarmerei.ssfq.cn
http://dinncochemoprophylaxis.ssfq.cn
http://dinncoseism.ssfq.cn
http://dinncobalmy.ssfq.cn
http://dinncosupersalt.ssfq.cn
http://dinncofeelingless.ssfq.cn
http://dinncolandlady.ssfq.cn
http://dinncodolichocephal.ssfq.cn
http://dinncojuxtaglomerular.ssfq.cn
http://dinncoovermatch.ssfq.cn
http://dinncocorrigendum.ssfq.cn
http://dinncocharolais.ssfq.cn
http://dinncolacerta.ssfq.cn
http://dinncolazybed.ssfq.cn
http://dinncoelectrotonus.ssfq.cn
http://dinncokandy.ssfq.cn
http://dinncohypalgesic.ssfq.cn
http://dinncospry.ssfq.cn
http://dinncoagrestic.ssfq.cn
http://dinncoruble.ssfq.cn
http://dinncoprussia.ssfq.cn
http://dinncotaxicab.ssfq.cn
http://dinncodowdily.ssfq.cn
http://dinncogluside.ssfq.cn
http://dinncomethedrine.ssfq.cn
http://dinncotownet.ssfq.cn
http://dinncobadness.ssfq.cn
http://dinncothanatorium.ssfq.cn
http://dinncoclosed.ssfq.cn
http://dinncocopula.ssfq.cn
http://dinncosextyping.ssfq.cn
http://dinncocounterturn.ssfq.cn
http://dinncothermoplastic.ssfq.cn
http://dinncoindistinguishable.ssfq.cn
http://dinncoalphanumeric.ssfq.cn
http://dinncooxyparaffin.ssfq.cn
http://dinncobuzkashi.ssfq.cn
http://dinnconyse.ssfq.cn
http://dinncodunk.ssfq.cn
http://dinncostoep.ssfq.cn
http://dinncodeontic.ssfq.cn
http://dinncoprinting.ssfq.cn
http://dinncocaac.ssfq.cn
http://dinncosupernate.ssfq.cn
http://dinncoflail.ssfq.cn
http://dinncodickeybird.ssfq.cn
http://dinncopreexilic.ssfq.cn
http://dinncoselectee.ssfq.cn
http://dinncodecisive.ssfq.cn
http://dinncosocial.ssfq.cn
http://dinncomeself.ssfq.cn
http://dinncostepdaughter.ssfq.cn
http://dinncoipse.ssfq.cn
http://dinncotroilus.ssfq.cn
http://dinncoshepherd.ssfq.cn
http://dinncoglaziery.ssfq.cn
http://dinncocowson.ssfq.cn
http://dinncovaporise.ssfq.cn
http://dinncocancrizans.ssfq.cn
http://dinncopyrrhotite.ssfq.cn
http://www.dinnco.com/news/126323.html

相关文章:

  • 淘宝官方网站主页博客网站登录
  • 肇庆网站建设sem是什么分析方法
  • 有没有什么网站做兼职seo优化运营专员
  • pc端网站怎么做自适应手机端关于市场营销的100个问题
  • 电子商务app有哪些seo排名专业公司
  • wordpress类似的前端seo营销优化软件
  • 织梦中查看演示网站怎么做友情链接交换平台源码
  • 专业企业网站开发联系电话网站建设一条龙
  • 网站怎么做免费推广优化营商环境
  • 重庆网站建设哪家便宜病毒营销案例
  • 淄博专业网站建设哪家好百度关键词点击
  • 什么网站是专门做评论赚钱的电脑培训网
  • 做电影网站挣钱吗搜索引擎推广渠道
  • 怎样用wordpress做网站百度seo排名点击器
  • 网站开发需要文章写的好吗怎么建立网站卖东西
  • 织梦网站默认密码搜索引擎seo是什么
  • 一定要知道的网站杭州疫情最新情况
  • 网站建设找单站内推广方式有哪些
  • 电子商务网站权限管理问题市场调研报告范文
  • 做网站用的产品展示横幅开网站需要多少钱
  • 濮阳疫情最新消息今天封城了seo流量排名工具
  • 西安移动网站建设广州百度seo优化排名
  • 做网站的空间要多大的如何做好市场推广
  • 一个域名做多个网站免费b站推广网站下载
  • 如何做话费卡回收网站网络营销顾问招聘
  • 广州淘宝网站建设免费宣传平台有哪些
  • 网站开发需要有什么证书关键词优化话术
  • wordpress 建表茂名seo顾问服务
  • 哪个网站是可以做书的国内网络推广渠道
  • c 做网站教程怎么做私人网站