import cv2
import numpy as np
import os
import random
from PIL import Image
import matplotlib.pyplot as plt
# 代码讲解:https://blog.csdn.net/qq_44886601/article/details/135764589
# 将mask绘制在原图
def draw_image(im, ms, brg, opacity):
image_mask = im.copy()
contours, _ = cv2.findContours(ms, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE) # 查找轮廓
image_mask = cv2.drawContours(image_mask, contours, -1, (0, 255, 0), 2) # 绘制边界
image_mask = cv2.fillPoly(image_mask, contours, color=brg) # 填充
img_bgr = cv2.addWeighted(im, opacity, image_mask, 1 - opacity, 0)
return im, ms, img_bgr
def main(imagePath, labelPath, bgr, opacity):
image = np.array(Image.open(imagePath).convert('RGB'))
label = np.array(Image.open(labelPath).convert('L'))
a, b, c = draw_image(image, label, bgr, opacity)
plt.figure(figsize=(12, 8))
for index, i in enumerate((a, b, c)):
plt.subplot(1, 3, index + 1)
plt.imshow(i)
plt.savefig('./result.png')
# plt.show()
if __name__ == '__main__':
root = './data/z/images'
images_path = [os.path.join(root, i) for i in os.listdir(root)]
r = random.randint(0, len(images_path) - 1)
img_path = images_path[r] # 随机取出一张图片
mask_path = img_path.replace('images', 'labels')
# opacity 越小,掩膜效果越深
main(imagePath=img_path, labelPath=mask_path, bgr=(0, 0, 255), opacity=0.5)
没有合适的资源?快使用搜索试试~ 我知道了~
医学图像分割数据集:肺部癌症(Lung)切片分割【包含3个切面划分好的数据集(2类别)、标签文件、可视化代码】
共2000个文件
png:1998个
py:1个
json:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 89 浏览量
2024-05-14
10:11:14
上传
评论
收藏 674.47MB 7Z 举报
温馨提示
项目包含:肺部癌症(Lung)切片分割【包含3个切面划分好的数据集(2类别)、标签文件、可视化代码】 【其中mask中1为肺部癌症病灶 、0为背景】 数据集为生物医学影像肺部癌症3D数据(nii.gz)的切片数据,分别从轴位面(横端面)、冠状面、矢状面切分出2D图像。图像和标签均为png格式,为了方便观察mask,提供了可视化代码(show.py) 数据集介绍:分为x、y、z轴的切面图像 x轴:512*512分辨率,images图片目录+masks模板目录,1657张图片和1657个对应的mask图片 y轴:512*304分辨率,images图片目录+masks模板目录,2976张图片和2976个对应的mask图片 z轴:512*304分辨率,images图片目录+masks模板目录,2860张图片和2860个对应的mask图片 除此之外,包含一个图像分割的可视化脚本,随机提取一张图片,将其原始图片、GT图像、GT在原图蒙板的图像展示,并保存在当前目录下。可以直接运行即
资源推荐
资源详情
资源评论
收起资源包目录
医学图像分割数据集:肺部癌症(Lung)切片分割【包含3个切面划分好的数据集(2类别)、标签文件、可视化代码】 (2000个子文件)
dataset.json 46B
x.png 90KB
z.png 32KB
lung_014_125.png 2KB
lung_014_127.png 2KB
lung_014_121.png 2KB
lung_014_122.png 2KB
lung_014_118.png 2KB
lung_014_123.png 2KB
lung_014_116.png 2KB
lung_014_115.png 2KB
lung_014_130.png 2KB
lung_014_114.png 2KB
lung_014_133.png 2KB
lung_014_135.png 2KB
lung_014_113.png 2KB
lung_014_136.png 2KB
lung_014_134.png 2KB
lung_014_138.png 1KB
lung_014_111.png 1KB
lung_014_139.png 1KB
lung_014_140.png 1KB
lung_014_141.png 1KB
lung_014_142.png 1KB
lung_014_107.png 1KB
lung_014_146.png 1KB
lung_014_144.png 1KB
lung_014_145.png 1KB
lung_047_112.png 1KB
lung_047_113.png 1KB
lung_047_118.png 1KB
lung_047_110.png 1KB
lung_047_114.png 1KB
lung_047_116.png 1KB
lung_047_115.png 1KB
lung_047_108.png 1KB
lung_047_126.png 1KB
lung_047_120.png 1KB
lung_047_107.png 1KB
lung_047_124.png 1KB
lung_047_121.png 1KB
lung_047_127.png 1KB
lung_047_106.png 1KB
lung_006_300.png 1KB
lung_022_189.png 1KB
lung_022_187.png 1KB
lung_047_105.png 1KB
lung_006_299.png 1KB
lung_022_188.png 1KB
lung_006_298.png 1KB
lung_006_297.png 1KB
lung_022_182.png 1KB
lung_047_104.png 1KB
lung_006_303.png 1KB
lung_006_296.png 1KB
lung_047_103.png 1KB
lung_047_129.png 1KB
lung_022_183.png 1KB
lung_022_190.png 1KB
lung_014_102.png 1KB
lung_022_174.png 1KB
lung_022_177.png 1KB
lung_014_150.png 1KB
lung_014_152.png 1KB
lung_006_295.png 1KB
lung_047_130.png 1KB
lung_022_186.png 1KB
lung_047_102.png 1KB
lung_022_184.png 1KB
lung_022_167.png 1KB
lung_022_171.png 1KB
lung_022_164.png 1KB
lung_022_172.png 1KB
lung_047_131.png 1KB
lung_022_178.png 1KB
lung_022_163.png 1KB
lung_014_151.png 1KB
lung_006_293.png 1KB
lung_022_176.png 1KB
lung_022_166.png 1KB
lung_022_161.png 1KB
lung_022_159.png 1KB
lung_006_294.png 1KB
lung_047_132.png 1KB
lung_022_191.png 1KB
lung_022_162.png 1KB
lung_022_165.png 1KB
lung_047_134.png 1KB
lung_047_133.png 1KB
lung_022_180.png 1KB
lung_022_158.png 1KB
lung_006_304.png 1KB
lung_047_135.png 1KB
lung_047_136.png 1KB
lung_014_155.png 1KB
lung_006_305.png 1KB
lung_022_157.png 1KB
lung_006_292.png 1KB
lung_006_291.png 1KB
lung_022_156.png 1KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
听风吹等浪起
- 粉丝: 1w+
- 资源: 1289
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于Java的本科探索学习项目设计源码 - 本科探索
- 基于Javascript和Python的微商城项目设计源码 - MicroMall
- 基于Java的网上订餐系统设计源码 - online ordering system
- 基于Javascript的超级美眉网络资源管理应用模块设计源码
- 基于Typescript和PHP的编程知识储备库设计源码 - study-php
- Screenshot_2024-05-28-11-40-58-177_com.tencent.mm.jpg
- 基于Dart的Flutter小提琴调音器APP设计源码 - violinhelper
- 基于JavaScript和CSS的随寻订购网页设计源码 - web-order
- 基于MATLAB的声纹识别系统设计源码 - VoiceprintRecognition
- 基于Java的微服务插件集合设计源码 - wsy-plugins
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功