in:(luna16)
*.mhd
*.raw
标注文件:annotations.csv
out:
大小为512*512,只包含一张scan的图片和掩膜
from __future__ import print_function, division
import SimpleITK as sitk
import numpy as np
import csv
from glob import glob
import os
import pandas as pd
try:
from tqdm import tqdm # long waits are not fun
except:
print('TQDM does make much nicer wait bars...')
tqdm = lambda x: x
#Some helper functions
def make_mask(center,diam,z,width,height,spacing,origin):
'''
Center : centers of circles px -- list of coordinates x,y,z
diam : diameters of circles px -- diameter
widthXheight : pixel dim of image
spacing = mm/px conversion rate np array x,y,z
origin = x,y,z mm np.array
z = z position of slice in world coordinates mm
'''
mask = np.zeros([height,width]) # 0's everywhere except nodule swapping x,y to match img
#convert to nodule space from world coordinates
# Defining the voxel range in which the nodule falls
v_center = (center-origin)/spacing
v_diam = int(diam/spacing[0]+5)
v_xmin = np.max([0,int(v_center[0]-v_diam)-5])

本文介绍了一种用于肺结节标注的方法,并演示了如何从医学影像中提取特定区域的过程。通过使用SimpleITK和NumPy等库,实现了肺部CT扫描中结节的自动标注及图像掩膜的生成。
最低0.47元/天 解锁文章
1872

被折叠的 条评论
为什么被折叠?



