for jj in range(0,numberOfPoints): ii = jj*3 conData[jj,0] = rfContent.ContourData[ii+0] conData[jj,1] = rfContent.ContourData[ii+1] conData[jj,2] = rfContent.ContourData[ii+2] pointData[jj,0] = round( (conData[jj,0] - dcmOrigin[0])/dcmSpacing[0] ) pointData[jj,1] = round( (conData[jj,1] - dcmOrigin[1])/dcmSpacing[1] ) pointData[jj,2] = dcmSOPs.index(dcmUID) if (isPlot==True) and (k<6): plt.subplot(1,6,k+1) plt.plot(conData[:,0],conData[:,1],'b.') plt.title('time={} z={}'.format(time,conData[0,2])) minX = np.min(pointData[:,0]) maxX = np.max(pointData[:,0]) minY = np.min(pointData[:,1]) maxY = np.max(pointData[:,1]) if minXY>minX: minXY = minX elif minXY>minY: minXY = minY elif maxXY<maxX: maxXY = maxX elif maxXY<maxY: maxXY = maxY if k==0: writeToFile(np.hstack((conData,pointData)).T,path+'\\GTV_indexs.txt','w') print("path of GTV_indexes.txt",path) else: writeToFile(np.hstack((conData,pointData)).T,path+'\\GTV_indexs.txt','a') cuts = np.array(cuts) return minXY,maxXY,cuts
时间: 2024-02-14 14:35:52 浏览: 59
jj.rar_JJ
这段代码是用来解析轮廓的顶点数据,将其转换为像素坐标并绘制轮廓。具体来说,它通过循环遍历每个顶点,然后从顶点数据中获取其X、Y和Z坐标并将其转换为像素坐标。接下来,代码将像素坐标存储在pointData数组中,并根据需要绘制轮廓。如果需要绘制轮廓,则代码会计算轮廓的最小和最大XY坐标,并将其用于设置绘图的尺寸。最后,代码会将顶点数据存储在GTV_indexes.txt文件中,并将其返回给调用方。
阅读全文