![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
VTK
文章平均质量分 61
VTK 学习笔记
wblong_cs
GIS,CAD ,3D ,BIM
展开
-
PCL+VTK 无序点集三角化及可视化
无序点集三角化及可视化。原创 2024-03-29 20:46:22 · 260 阅读 · 0 评论 -
ParaView Volume MHD
ParaView Volume MHD离散点P{ (x,y,z,p),… }插值生成体数据Volume,借用ParaView;导入CSV离散点集File->Open,打开*.csv文件,选择分割符(Field Delimter),生成表格数据。TableToPoints表格数据生成几何点数据。PointVolumeInterpolator几何点数据内插生成Volume,即Uniform Rectilinear Grid。插值方法:VoronoiKernel、ShepardKe原创 2022-05-08 19:38:58 · 1052 阅读 · 1 评论 -
PyVista&VTK Data Model
PyVista&VTK Data Model在VTK或PyVista中可视化数据,需要两条信息:数据的几何图形(描述数据在空间中的位置及其值)和拓扑结构cells(描述数据集中的点如何相互连接)。在抽象层,有vtkDataObject,它只是没有几何结构或拓扑结构的数据“点(属性数据)”。其中包含vtkFieldData的数组。在具体类层是vtkDataSet,它将几何图形和拓扑添加到vtkDataObject。与数据集中的每个点或单元关联的是一个特定值。由于这些值必须在空间中定位和连接,所以原创 2022-04-27 22:26:39 · 1252 阅读 · 0 评论 -
ParaView & UE4 Volume Render
ParaView & UE4 Volume RenderParaView 数据处理生成Volume,以mhd文件存储,也可借用PVGeo和Pyvista生成Volume。在UE4中渲染Volume使用Raymacher插件渲染,主要涉及UE4的VolumeTexture。Process VolumePVGeo&Pyvistahttps://blog.csdn.net/mrbaolong/article/details/124363264?spm=1001.2014.3001.550原创 2022-04-25 21:14:27 · 1513 阅读 · 0 评论 -
Volume Process
Volume ProcessLoad the Data# Load the a TensorMesh and some already processed model data mesh = discretize.TensorMesh.readUBC('craig_chile.msh', directory='data/Craig-Chile')models = {'lpout': mesh.readModelUBC(fileName='Lpout.mod', directory='data/Cr原创 2022-04-23 14:39:19 · 656 阅读 · 0 评论 -
空间范围内剪切盒的生成
#define ZERO_VALUE 0#define PI 3.14159265358979//点pos绕中心点CenterPos旋转anglefloat2 RotateCenterPoint(float2 CenterPos,float angle,float2 pos){ return float2( (pos.x - Cen...原创 2019-12-06 10:07:47 · 296 阅读 · 0 评论 -
VTK Learning Forty-One - AABB & OBB Visualization
常用的包围盒轴对齐包围盒(AABB/Axis-aligned bounding box):包围盒按照坐标系的坐标轴进行排列。有向包围盒(OBB/Oriented bounding box):包围模型的最小盒子,是根据模型的几何形状来决定包围盒的大小和方向,无需和坐标轴垂直,方向是任意的。可视化比较#include <vtkActor.h>#include <vtkOBBTree.h>#include <vtkCallbackCommand.h>#inc原创 2020-07-02 19:04:23 · 560 阅读 · 0 评论 -
VTK Learning Forty - Octree Visualization
八叉树可用于索引、抽稀等等。随着八叉树的层级越大,越接近于模型。import vtk# 观察者class SliderObserver(object): def __init__(self, Octree, polyData, renderer): self.Octree = Octree self.level = 0 self.polyData = polyData self.renderer = renderer原创 2020-06-28 15:23:20 · 533 阅读 · 0 评论 -
vtk管线入门3
RequestUpdateExtent测试1import vtkfrom vtk.util.vtkAlgorithm import VTKPythonAlgorithmBasefrom vtk.util import keys# 元数据requestKey = keys.MakeKey(keys.IntegerRequestKey, "a request", "my module")class MySource(VTKPythonAlgorithmBase): def __init_原创 2020-06-27 18:55:52 · 360 阅读 · 0 评论 -
vtk管线入门2
一个简单的管线:import vtkfrom vtk.util.vtkAlgorithm import VTKPythonAlgorithmBase class MySource(VTKPythonAlgorithmBase): def __init__(self): VTKPythonAlgorithmBase.__init__(self, nInputPorts=0, nOutputPorts=1, outputType=原创 2020-06-27 17:59:49 · 297 阅读 · 0 评论 -
vtk管线入门1
vtkInformation 和 vtkInformationVectorvtkInformation 和 vtkInformationVector实际是maps存储着vtk管线中的数据。vtkInformationVector相当于vtkInformation数组。import vtkinfo = vtk.vtkInformation()info.Set(vtk.vtkStreamingDemandDrivenPipeline.UPDATE_PIECE_NUMBER(), 1) print原创 2020-06-27 17:19:33 · 466 阅读 · 0 评论 -
python自定义vtk算法 - vtkPythonAlgorithm is great
python自定义vtk算法vtkPythonAlgorithm is great使用vtkPythonAlgorithm定义vtkPythonAlgorithm对象通过SetPythonObject()使用自定义算法对象调用Initialize(self, vtkself)把vtkPythonAlgorithm引用传递给自定义算法对象将以下方法委托给自定义算法对象ProcessRequest(self, vtkself, request, inInfo, outInfo)FillInp原创 2020-06-27 17:04:26 · 510 阅读 · 0 评论 -
PVGeo-Examples 2.2 - omfvtk
import pyvistaimport omfvistapyvista.set_plot_theme('document')project = omfvista.load_project('data/test_file.omf')projectInformationBlocksMultiBlockValuesN Blocks9X Bounds443941.105, 447059.611Y Bounds491941.536, 495059.859Z Bounds2330.000,原创 2020-06-26 18:36:02 · 351 阅读 · 0 评论 -
PVGeo-Examples 2.1 - Loading-Shapefiles-To-VTK
import shapefileimport numpy as npimport vtkimport pyvista# sklearn's KDTree is fast: use it if available# Scipy also also a good KDTreefrom sklearn.neighbors import KDTree as Tree# Define conveinance functions for converting shape files to VTK o原创 2020-06-26 18:32:09 · 324 阅读 · 0 评论 -
PVGeo-Examples 2.0 - PVGeo+Discretize
PVGeo-DiscretizeThis notebook demonstrates how to pair PVGeo and discretize for simple processing routines.This notebook is outlined into four sections:Introduction to PVGeoOverview of new VTK interface in discretizePairing PVGeo and discretizeExamp转载 2020-06-26 18:26:05 · 1467 阅读 · 0 评论 -
PVGeo-Examples 1.1 - Using the pyvista Package
WIP: Using the pyvista PackageThis notebook is a work in progress to demo how PVGeo can be used with pyvista for creating integrated visualizations directly in a Python environment. At this time, the 3D rendering is perfromed in a separate window and we h原创 2020-06-26 18:10:10 · 772 阅读 · 0 评论 -
PVGeo-Examples 1.0 - Welcome
import PVGeoimport numpy as npimport pandas as pdimport pyvistaprint('NumPy Version: %s' % np.__version__)print('PVGeo Version: %s' % PVGeo.__version__)print('pyvista Version: %s' % pyvista.__version__)NumPy Version: 1.18.5PVGeo Version: 2.1.0py原创 2020-06-26 18:00:29 · 541 阅读 · 0 评论 -
“圆柱”曲面展开
“圆柱”曲面展开沿轴向展开,展开后横坐标为弧长,纵坐标为轴向坐标,高程为曲面到参考圆柱曲面的距离。定义参考圆柱//!轴enum AXIS { AXIS_X, AXIS_Y, AXIS_Z};//! 投影圆柱struct GEO_CYLINDER{ //!轴向 AXIS Axial; //!径向:横/纵 ,横向弧长,纵向偏差 AXIS RadialTran; AXIS RadialLong; //!径向截面圆心中心 double CenterTran; double Ce原创 2020-06-24 18:19:35 · 5345 阅读 · 5 评论 -
VTK Learning Thirty-nine- 有限元结果可视化 (DisplacementPlot)
paraview 数据可视化用paraview打开plate.vtk,在属性信息一栏中(Information),可以看到有mode1、mode2、mode3、mode4和mode8五种有限元结果属性数据,它们可以表示几何体在每一个点上的位移,vtkWarpVector类可以用这些矢量数据来变形几何体,在该类中可以设置矢量数据以及缩放的比例,控制几何体的变形。原始几何体添加 Filters->WrapByVector ,并选择属性mode1,设置 Scale Factor 为1。变形后的几何原创 2020-06-13 17:42:12 · 2207 阅读 · 2 评论 -
VTK Learning Thirty-eight- Fill holes
有时候生成的隧道会有缺失(有洞),需要修复填补这些洞。方式一 :vtkFillHolesFilter vtkSmartPointer<vtkFillHolesFilter> fillHolesFilter = vtkSmartPointer<vtkFillHolesFilter>::New(); fillHolesFilter->SetInputData(input); fillHolesFilter->SetHoleSize(0.5); fillHoles原创 2020-05-28 18:10:27 · 639 阅读 · 2 评论 -
VTK Learning Thirty-seven- Voxelize a Surface Mesh
三维像素化曲面网格(网格曲面的体元化)创建封闭曲面网格和网格体的体元模型。示例演示了如何从包围盒计算隐式距离。体元化步骤确定体元的大小。生成vtkUnStructuredGrid确定体元是否在封闭曲面内或体中def voxelize(mesh, density=None, check_surface=True): """Voxelize mesh to UnstructuredGrid. Parameters ---------- density : fl原创 2020-05-28 16:14:15 · 744 阅读 · 0 评论 -
VTK Learning Thirty-six- rotate polydata
pyvista 读取vtk 文件,旋转之后,并另存。import pyvista as pv# 读取polydatamesh=pv.read("door.vtp")mesh.plot()# 绕z 轴旋转180mesh.rotate_z(180)print(mesh)mesh.plot()# 保存旋转之后的结果mesh.save("door.vtp")旋转之前:旋转之后:pyvista 旋转操作源码def axis_rotation(points, angle, inplac原创 2020-05-27 18:32:23 · 423 阅读 · 0 评论 -
VTK Learning Thirty-five- clipping with surface
使用曲面进行切割import pyvista as pvimport numpy as npmesh = pv.ParametricRandomHills()mesh.rotate_y(90)surface= mesh.elevation()# Create a grid around that surface# 根据生成的mesh生成网格grid = pv.create_grid(surface)# Clip the grid using the surfacemodel = g原创 2020-05-26 20:13:23 · 410 阅读 · 0 评论 -
VTK Learning Thirty-four- FrenetSerret
ExtrudePolyDataAlongLine (沿着线拉伸多变形)Obtain the 2D polydata from a file( or generate a disk).第一步获取截面轮廓线(contours)。Generates random points in 3D space and fits a spline to the points.第二步生成放样线,即轮廓线沿着这条线放样。Computes an orientation frame at each point on th原创 2020-05-26 19:40:05 · 882 阅读 · 2 评论 -
VTK Learning Thirty-three - pyvista Geometry
Geometric Objects 绘制预定义简单几何体对象import pyvista as pvcyl = pv.Cylinder()arrow = pv.Arrow()sphere = pv.Sphere()plane = pv.Plane()line = pv.Line()box = pv.Box()cone = pv.Cone()poly = pv.Polygon()disc = pv.Disc()p = pv.Plotter(shape=(3, 3))# Top ro原创 2020-05-24 22:42:43 · 279 阅读 · 0 评论 -
VTK Learning Thirty-two - pyvista Topographic Map
影像叠加地形图拉伸地形图elevation = elevation_dataobj.warp_by_scalar() 地形图按照高程属性拉伸成曲面贴纹理topo_map = pv.read_texture(image_filename)# Bounds of the aerial imagery - given to usbounds = (1818000,1824500,5645000,5652500,0,3000)# Clip the elevation dataset to the原创 2020-05-24 19:41:33 · 485 阅读 · 0 评论 -
VTK Learning Thirty-one - pyvista
pyvista is a high-level API to the VTK创建规则网格曲面# sphinx_gallery_thumbnail_number = 2import pyvista as pvimport numpy as np生成一个二维的正弦曲面# Make datax = np.arange(-10, 10, 0.25)y = np.arange(-10, 10, 0.25)x, y = np.meshgrid(x, y)r = np.sqrt(x ** 2 +原创 2020-05-23 21:52:25 · 443 阅读 · 0 评论 -
VTK Learning Thirty - vtkPolyData to CGAL Surface_mesh
VTK Learning Thirty - vtkPolyData to CGAL Surface_meshDescription将vtkPolyData转换成CGAL::Surface_mesh,并利用CGAL的布尔运算对数据进行处理,然后再将处理后的CGAL::Surface_mesh转换成vtkPolyData进行可视化渲染。定义 CGAL::Surface_meshtypedef CGAL::Exact_predicates_inexact_constructions_kernel EP原创 2020-05-16 20:54:43 · 1517 阅读 · 10 评论 -
CGAL 加载 VTK 数据进行简单布尔运算
原创 2020-05-14 18:33:25 · 1047 阅读 · 0 评论 -
VTK Learning Twenty-nine- surface normal
VTK Learning Twenty-nine- surface normalDescriptionvtkPolyDataNormals计算多边形网格( polygonal mesh)的法向量。同时能够重新排序多边形顶点的顺序以确保邻接多边形方向一致。能够整体翻转曲面的法向量,使得曲面的法向量方向一致。三维平面的法向量是指垂直于该平面的三维向量。曲面在某点P处的法向量为垂直于该点切平面的向量。对于一个网格模型,每个点和单元cell都可以计算一个法向量,在三维计算机图形学中法向量一个重要的应用原创 2020-05-13 22:18:06 · 306 阅读 · 0 评论 -
VTK Learning Twenty-eight- vtkbool tunnel
Description利用paraview 生成Box和tube管线,测试vtkbool bool运算。Code#include <vtkXMLPolyDataReader.h>#include<vtkPolyDataMapper.h>#include<vtkActor.h>#include<vtkRenderer.h>#include<vtkRenderWindow.h>#include<vtkRenderWindowInt原创 2020-05-10 21:27:47 · 282 阅读 · 0 评论 -
Paraview 测试生成管线
vtkTubeFilter可以用来生成包围一条折线的管道。下面是一个vtkTubeFilter的使用例子。围绕一条线创建一条管道。添加一条线添加tube FilterReferencevtkTubeFilter生成管道原创 2020-05-10 14:26:03 · 516 阅读 · 0 评论 -
VTK Learning Twenty-seven- vtkbool
VTK Learning Twenty-seven- vtkboolDescriptionvtkbool复杂多变形网格的布尔操作。示例为从正方体中挖去一个圆柱体。Code#include<vtkCubeSource.h>#include<vtkCylinderSource.h>#include<vtkPolyDataMapper.h>#include<vtkActor.h>#include<vtkRenderer.h>#inclu原创 2020-05-08 21:39:17 · 490 阅读 · 1 评论 -
VTK Learning Twenty-six- PointInterpolator Two
PointInterpolator - ImageDataDescription利用PointInterpolator插值生成三维栅格数据。属性值受空间位置(x,y,z)影响。生成插值网格体res = 40# Create a probe volumecenter = output.GetCenter()bounds = output.GetBounds()length = out...原创 2020-05-07 13:56:50 · 719 阅读 · 1 评论 -
VTK Learning Twenty-five- PointInterpolator One
vtkPointInterpolator描述interpolate over point cloud using various kernels使用各种核函数插值点云数据vtkPointInterpolator probes a point cloud Pc (the filter Source) with a set of points P (the filter Input), int...原创 2020-05-07 12:28:58 · 836 阅读 · 3 评论 -
VTK Learning Twenty-four- PointInterpolator2D(二)
VTK Learning Twenty-three- PointInterpolator2DDescription对地形数据高程偏移(根据高程属性来确定Z值),并根据模拟的属性值确定地形数据的属性。Code#!/usr/bin/env pythonimport vtkfrom vtk.util.misc import vtkGetDataRootVTK_DATA_ROOT = vtk...原创 2020-05-01 22:50:35 · 329 阅读 · 0 评论 -
VTK Learning Twenty-three- PointInterpolator2D(一)
VTK Learning Twenty-three- PointInterpolator2DDescriptionuse terrain dataset. Just for kicks we’ll treat the elevations as a “point cloud” and interpolate the elevation onto a plane.使用DEM数据。在平面上内插高...原创 2020-05-01 22:32:12 · 470 阅读 · 0 评论 -
网格平滑vtkSmoothPolyDataFilter
网格平滑vtkSmoothPolyDataFilter网格平滑是一种调整数据集中点坐标的技术。网格平滑的目的是提高网格的外观和提高单元数据集的形状。在平滑过程中,不会改变数据集的拓扑结构,只改变几何结构。网格平滑的应用包括提高等值面的外观,或者作为移除表面噪声的模型工具。通过应用网格平滑,模型的外观能够动态地提高。拉普拉斯平滑是一种常用的平滑算法。`VTK`中 的`vtkSmoothPol...转载 2020-04-30 12:40:04 · 2011 阅读 · 0 评论 -
vtk python3环境安装配置
vtk python3环境安装配置安装miniconda下载地址:https://docs.conda.io/en/latest/miniconda.htmlhttps://docs.conda.io/en/latest/miniconda.html#windows-installers创建环境conda create env --name vtk安装vtk包conda instal...原创 2020-04-27 23:25:18 · 1285 阅读 · 0 评论 -
VTK Learning Twenty-two- fault triangulation
VTK Learning Twenty-two- fault triangulationDescriptionCreate a constrained Delaunay triangulation following fault lines. Thefault lines serve as constraint edges in the Delaunay triangulation.根据断...原创 2020-04-27 18:23:54 · 295 阅读 · 3 评论