南京市溧水区建设局网站做手机网站

张小明 2026/1/10 0:30:45
南京市溧水区建设局网站,做手机网站,网页制作培训证重要吗,360建设网站免费下载一#xff1a;主要的知识点 1、说明 本文只是教程内容的一小段#xff0c;因博客字数限制#xff0c;故进行拆分。主教程链接#xff1a;vtk教程——逐行解析官网所有Python示例-CSDN博客 2、知识点纪要 本段代码主要涉及的有①三维图形转换为3D体素数据 二#xff1a…一主要的知识点1、说明本文只是教程内容的一小段因博客字数限制故进行拆分。主教程链接vtk教程——逐行解析官网所有Python示例-CSDN博客2、知识点纪要本段代码主要涉及的有①三维图形转换为3D体素数据二代码及注释import math import vtkmodules.vtkRenderingOpenGL2 import vtkmodules.vtkInteractionStyle from vtkmodules.vtkFiltersSources import vtkSphereSource from vtkmodules.vtkFiltersCore import vtkCutter, vtkStripper from vtkmodules.vtkCommonDataModel import vtkImageData, vtkPlane from vtkmodules.vtkIOXML import vtkXMLPolyDataWriter from vtkmodules.vtkCommonCore import VTK_UNSIGNED_CHAR from vtkmodules.vtkFiltersModeling import vtkLinearExtrusionFilter from vtkmodules.vtkImagingStencil import vtkImageStencil, vtkPolyDataToImageStencil from vtkmodules.vtkIOImage import vtkMetaImageWriter, vtkPNGWriter def main(): # 创建一个3D图形 sphereSource vtkSphereSource() sphereSource.SetPhiResolution(30) sphereSource.SetThetaResolution(30) sphereSource.SetCenter(40, 40, 40) sphereSource.SetRadius(20) # 切割数据集的刀 # 首先先定义这个刀是什么需要使用隐函数定义 cutPlane vtkPlane() cutPlane.SetOrigin(sphereSource.GetCenter()) cutPlane.SetNormal(0, 0, 1) circleCutter vtkCutter() circleCutter.SetInputConnection(sphereSource.GetOutputPort()) circleCutter.SetCutFunction(cutPlane) stripper vtkStripper() stripper.SetInputConnection(circleCutter.GetOutputPort()) stripper.Update() circle stripper.GetOutput() # 写入vtp文件 polyDataWriter vtkXMLPolyDataWriter() polyDataWriter.SetInputData(circle) polyDataWriter.SetFileName(circle.vtp) polyDataWriter.SetCompressorTypeToNone() # 不适用任何压缩 polyDataWriter.SetDataModeToAscii() # 设置输出文件中的数据以ASCII文本格式存储 polyDataWriter.Write() # 准备一个体素数据 whiteImage vtkImageData() bounds [0] * 6 circle.GetBounds(bounds) spacing [0.5, 0.5, 0.5] whiteImage.SetSpacing(spacing) # 计算这个体素数据的维度 dim [0] * 3 for i in range(3): dim[i] int(math.ceil((bounds[i * 2 1] - bounds[i * 2]) / spacing[i])) 1 if dim[i] 1: dim[i] 1 whiteImage.SetDimensions(dim) # 算是设置了图像体素的数量 # SetExtent 设置了图像的索引范围 确保了生成的 3D 图像的体素网格是最小且精确的既不浪费内存又能完整地覆盖输入的几何体 whiteImage.SetExtent(0, dim[0] - 1, 0, dim[1] - 1, 0, dim[2] - 1) origin_shift 5 * 0.5 origin [0] * 3 origin[0] bounds[0] - origin_shift origin[1] bounds[2] - origin_shift origin[2] bounds[4] - origin_shift # 上述添加origin_shift是为了vtkImageData能够完全包裹住mesh whiteImage.SetOrigin(origin) # AllocateScalars # 为图像的体素数据分配内存。VTK_UNSIGNED_CHAR无符号字符范围 0-2551 表示每个体素有一个分量即灰度值 whiteImage.AllocateScalars(VTK_UNSIGNED_CHAR, 1) # 将 整个 3D 图像体素网格预先填充为前景值即白色 # inval 255 outval 0 # count whiteImage.GetNumberOfPoints() # for i in range(count): # whiteImage.GetPointData().GetScalars().SetTuple1(i, inval) # 上述for循环的简便替代方法 whiteImage.GetPointData().GetScalars().Fill(255) extrude vtkLinearExtrusionFilter() extrude.SetInputData(circle) extrude.SetScaleFactor(1.0) # 设置挤压的比例因子 extrude.SetExtrusionTypeToVectorExtrusion() # 设置为向量挤压而非几何体表面的法线定义 extrude.SetVector(0, 0, 1) # 设置挤压的向量 extrude.Update() pol2stenc vtkPolyDataToImageStencil() pol2stenc.SetInputConnection(extrude.GetOutputPort()) pol2stenc.SetTolerance(0) # 帮助过滤垂直面 pol2stenc.SetOutputOrigin(origin) pol2stenc.SetOutputSpacing(spacing) pol2stenc.SetOutputWholeExtent(whiteImage.GetExtent()) pol2stenc.Update() imgstenc vtkImageStencil() tkImageStencil 是另一个关键过滤器它接收一个图像作为输入并根据一个模板Stencil修改该图像的像素值。 imgstenc.SetInputData(whiteImage) imgstenc.SetStencilConnection(pol2stenc.GetOutputPort()) imgstenc.ReverseStencilOff() imgstenc.SetBackgroundValue(outval) imgstenc.Update() imageWriter vtkMetaImageWriter() imageWriter.SetFileName(labelImage.mhd) imageWriter.SetInputConnection(imgstenc.GetOutputPort()) imageWriter.Write() imageWriter vtkPNGWriter() imageWriter.SetFileName(labelImage.png) imageWriter.SetInputConnection(imgstenc.GetOutputPort()) imageWriter.Write() if __name__ __main__: main()
版权声明:本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

响应式的网站建设一个多少钱查降权网站

Zepp Life智能刷步数自动化方案:高效解决运动数据同步难题 【免费下载链接】mimotion 小米运动刷步数(微信支付宝)支持邮箱登录 项目地址: https://gitcode.com/gh_mirrors/mimo/mimotion 还在为每日运动打卡发愁?想要让Ze…

张小明 2026/1/8 11:16:43 网站建设

高端上海网站设计公司重庆介绍ppt制作

在网络安全行业,证书常被视为入行的 “敲门砖”,尤其是对零基础求职者而言,它能快速证明专业能力、增加面试竞争力。但实战经验、技术功底同样是企业招聘的核心考量,不少资深从业者凭借项目经历也能站稳脚跟,所以证书并…

张小明 2026/1/9 0:29:21 网站建设

南宁h5建站商业网站设计的基本原则

基于情绪感知的智能语音合成:Dify 与 CosyVoice3 的协同实践 在虚拟主播用欢快语调播报好消息、客服机器人察觉用户不满后语气转为温和的今天,语音不再只是信息的载体,更成为情感交流的桥梁。人们早已不满足于“机器能说话”,而是…

张小明 2026/1/8 22:36:07 网站建设

没公司怎么做网站基于dw的动物网站设计论文

你是否曾经在客厅沙发上渴望玩书房电脑里的3A大作,却总是被卡顿和延迟劝退?当你满怀期待地想在平板上体验PC游戏的高画质,却发现色彩失真、操作响应慢如蜗牛?这种令人沮丧的游戏体验,我们一起来解决。 【免费下载链接】…

张小明 2026/1/8 17:00:38 网站建设

医疗网络推广外包网站优化试卷

城通网盘终极提速方案:一键获取高速直连下载地址 【免费下载链接】ctfileGet 获取城通网盘一次性直连地址 项目地址: https://gitcode.com/gh_mirrors/ct/ctfileGet 还在为城通网盘的龟速下载而抓狂?每次下载都要忍受繁琐的验证码和漫长的等待时间…

张小明 2026/1/8 15:21:36 网站建设

中国建设企业协会网站首页wordpress慢 数据库6

HTML to Figma是一款革命性的Chrome扩展工具,它能够将任何网页的HTML内容快速转换为Figma设计图层,极大地简化了从网页到设计的工作流程。无论你是设计师、开发者还是产品经理,这款工具都能帮助你高效完成设计参考和原型制作。 【免费下载链接…

张小明 2026/1/8 22:36:28 网站建设