欢迎大家加入社区,雪易VTK社区-CSDN社区云

前言:目前在做模型的ReMesh,在研究这个接口,希望能有所帮助。

vtkPointInterpolator

描述:

变量:

Strategy:MASK_POINTS, NULL_VALUE, CLOSEST_POINT

指定插补过程中遇到“空”点时使用的策略。当局部邻域(要进行插值的相邻点的邻域)为空时,就会出现空点。若策略设置为MaskPoints,则创建一个输出数组,将点标记为有效或无效。若策略设置为NullValue(默认值),则输出数据值设置为NullPoint值(在输出点数据中指定)。若策略为ClosePoint,则简单地使用最近的点来执行插值。

目录

vtkInterpolationKernel

vtkGeneralizedKernel

vtkEllipsoidalGaussianKernel

vtkGaussianKernel

vtkLinearKernel

vtkProbabilisticVoronoiKernel

vtkShepardKernel

vtkSPHKernel


vtkInterpolationKernel

vtkGeneralizedKernel

描述:vtkGeneralizedKernel是一个抽象类,具有重要的属性:权值是归一化的;基础的占用空间是可配置的;概率加权函数可用于偏爱某些权重。

权值是归一化的

归一化权值即Sum(w_i) = 1;这确保了插值具有良好的质量。

基础的占用空间是可配置的

插值footprint是用于执行插值过程的点集。例如可以选择基于半径的内核和基于N个邻域点的内核。内核的性能和数学属性会根据选择的内核类型而有很大的不同。例如基于半径的内核,如果半径过大,则算法将以n^3执行。

在高级用法中,可以将概率函数应用于计算插值权重。概率函数是对某点的数据准确的置信度估计。一个典型的应用是当激光扫描用于获取点测量时,它返回法线,表示与直接的、接近正交的命中相比的掠射返回。

常用方法:

ComputeBasis

    /*** Based on the kernel style, invoke the appropriate locator method to* obtain the points making up the basis. Given a point x (and optional* associated point id), determine the points around x which form an* interpolation basis. The user must provide the vtkIdList pIds, which* will be dynamically resized as necessary. The method returns the number* of points in the basis. Typically this method is called before* ComputeWeights(). Note that ptId is optional in most cases, although in* some kernels it is used to facilitate basis computation.*///基于内核样式,调用适当的定位器方法来获得组成Basis的点。给定一个点x(和可选的关联点id),确定在//在x周围形成插值Basis的点。用户必须提供pIds,它将根据需要动态调整大小。//该方法返回Basis中的点数,通常在ComputeWeights()之前调用该方法。vtkIdType ComputeBasis(double x[3], vtkIdList* pIds, vtkIdType ptId = 0) override;

ComputeWeights

/*** Given a point x, a list of basis points pIds, and a probability* weighting function prob, compute interpolation weights associated with* these basis points.  Note that basis points list pIds, the probability* weighting prob, and the weights array are provided by the caller of the* method, and may be dynamically resized as necessary. The method returns* the number of weights (pIds may be resized in some cases). Typically* this method is called after ComputeBasis(), although advanced users can* invoke ComputeWeights() and provide the interpolation basis points pIds* directly. The probably weighting prob are numbers 0<=prob<=1 which are* multiplied against the interpolation weights before normalization. They* are estimates of local confidence of weights. The prob may be nullptr in* which all probabilities are considered =1.*/
//给定一个点x,一组几点pIds和一个概率加权函数probb,计算这些基点相关的插值权重。
//该方法返回权重的数量(在某些情况下可以调整pIds的大小),通常在ComputeBasis()之后调用。
//加权概率prob是数字0<= probb <=1,在归一化之前乘以插值权重。它们是加权局部置信度的估计。
//prob可能是nullptr,其中所有概率都被认为是=1。
virtual vtkIdType ComputeWeights(double x[3], vtkIdList* pIds, vtkDoubleArray* prob, vtkDoubleArray* weights) = 0;

KernelStyle:RADIUS, N_CLOSEST

/*** Specify the interpolation basis style. By default, a Radius style is* used (i.e., the basis is defined from all points within a specified* radius). However, it is also possible to select the N closest points* (NClosest). Note that in most formulations the Radius style is assumed* as it provides better mathematical properties. However, for convenience* some bases are easier to use when the N closest points are taken.*/
//指定插值基样式。默认情况下,使用半径样式(即,从指定半径内的所有点定义基础)。但是,也可以选择N个
//最近的点(nnearest)。
//请注意,在大多数公式中采用半径样式,因为它提供了更好的数学属性。
//然而,为了方便起见,当取N个最近的点时,一些基底更容易使用。
vtkSetMacro(KernelFootprint, int);
vtkGetMacro(KernelFootprint, int);
void SetKernelFootprintToRadius() { this->SetKernelFootprint(RADIUS); }
void SetKernelFootprintToNClosest() { this->SetKernelFootprint(N_CLOSEST); }

NormalizeWeights权重归一化

/*** Indicate whether the interpolation weights should be normalized after they* are computed. Generally this is left on as it results in more reasonable* behavior.*/
//插值权重计算后是否应归一化。通常情况下,这是保留的,因为它会导致更合理的行为。
vtkSetMacro(NormalizeWeights, bool);

vtkEllipsoidalGaussianKernel

描述:vtkEllipsoidalaussianKernel是一个插值核,返回由半径R定义的椭球中所有点的权重(结合法线或者标量数据)。“pancake”权重(与最小椭球轴平行的局部法线);“needle”权重(与最大椭球轴平面的局部法线)。vtkGaussianKernel可以更有效的计算球形高斯权重。

vtkGaussianKernel

描述:vtkGaussianKernel是一个插值核,它简单地返回由半径R定义的球中所有点的权重。权重计算为:exp(-(s*r/ R)^2),其中r是从要插值的点到r内邻近点的距离。锐度s只是影响高斯函数的下降速率。(更通用的高斯内核可以从vtkEllipsoidalGaussianKernel中获得。)

vtkIdType vtkGaussianKernel::ComputeWeights(double x[3], vtkIdList* pIds, vtkDoubleArray* prob, vtkDoubleArray* weights)
{vtkIdType numPts = pIds->GetNumberOfIds();double d2, y[3], sum = 0.0;weights->SetNumberOfTuples(numPts);double* p = (prob ? prob->GetPointer(0) : nullptr);double* w = weights->GetPointer(0);double f2 = this->F2;for (vtkIdType i = 0; i < numPts; ++i){vtkIdType id = pIds->GetId(i);this->DataSet->GetPoint(id, y);d2 = vtkMath::Distance2BetweenPoints(x, y);if (vtkMathUtilities::FuzzyCompare(d2, 0.0, std::numeric_limits<double>::epsilon() * 256.0)) // precise hit on existing point{pIds->SetNumberOfIds(1);pIds->SetId(0, id);weights->SetNumberOfTuples(1);weights->SetValue(0, 1.0);return 1;}else{w[i] = (p ? p[i] * exp(-f2 * d2) : exp(-f2 * d2));sum += w[i];}} // over all points// Normalizeif (this->NormalizeWeights && sum != 0.0){for (vtkIdType i = 0; i < numPts; ++i){w[i] /= sum;}}return numPts;
}

vtkLinearKernel

描述:vtkLinearKernel是一个插值核,它为Basis中所有点的均值。

vtkIdType vtkLinearKernel::ComputeWeights(double*, vtkIdList* pIds, vtkDoubleArray* prob, vtkDoubleArray* weights)
{vtkIdType numPts = pIds->GetNumberOfIds();double* p = (prob ? prob->GetPointer(0) : nullptr);weights->SetNumberOfTuples(numPts);double* w = weights->GetPointer(0);double weight = 1.0 / static_cast<double>(numPts);if (!prob) // standard linear interpolation{for (vtkIdType i = 0; i < numPts; ++i){w[i] = weight;}}else // weight by probability{double sum = 0.0;for (vtkIdType i = 0; i < numPts; ++i){w[i] = weight * p[i];sum += w[i];}// Now normalizeif (this->NormalizeWeights && sum != 0.0){for (vtkIdType i = 0; i < numPts; ++i){w[i] /= sum;}}}return numPts;
}

vtkProbabilisticVoronoiKernel

描述:vtkProbabilisticVoronoiKernel是一个插值核,它从点的邻域中最近的加权点进行插值。权重指的是可以提供给ComputeWeights()方法的概率权重。

如果没有定义概率权重,则内核提供与vtkVoronoiKernel相同的结果,只是效率较低。

vtkIdType vtkProbabilisticVoronoiKernel::ComputeWeights(double x[3], vtkIdList* pIds, vtkDoubleArray* prob, vtkDoubleArray* weights)
{vtkIdType numPts = pIds->GetNumberOfIds();double* p = (prob ? prob->GetPointer(0) : nullptr);double highestProbability = VTK_FLOAT_MIN;vtkIdType id, mostProbableId = 0;if (p) // return the point in the neighborhood with the highest probability{for (vtkIdType i = 0; i < numPts; ++i){if (p[i] > highestProbability){mostProbableId = pIds->GetId(i);highestProbability = p[i];}}}else // return the closest point in the footprint provided{double y[3], d, minD = VTK_FLOAT_MAX;for (vtkIdType i = 0; i < numPts; ++i){id = pIds->GetId(i);this->DataSet->GetPoint(id, y);d = vtkMath::Distance2BetweenPoints(x, y);if (vtkMathUtilities::FuzzyCompare(d, 0.0,std::numeric_limits<double>::epsilon() * 256.0)) // precise hit on existing point{mostProbableId = id;break;}else if (d <= minD){mostProbableId = id;minD = d;}} // over all points}// Okay let's get outpIds->SetNumberOfIds(1);pIds->SetId(0, mostProbableId);weights->SetNumberOfTuples(1);weights->SetValue(0, 1.0);return 1;
}

vtkShepardKernel

描述:vtkShepardKernel是一个使用Shepard方法进行插值的插值内核。权值计算为1/r^p,其中r是到核半径r内邻居点的距离;p(幂参数)是一个正指数(通常p=2)。

如果相邻点p恰好位于要插值的点上,则被插值点取与p相关的值。

vtkVoronoiKernel

描述:vtkVoronoiKernel是一个插值内核,它只返回与要插值的点最近的点。返回值为1.0的单个权重。

vtkIdType vtkVoronoiKernel::ComputeBasis(double x[3], vtkIdList* pIds, vtkIdType)
{pIds->SetNumberOfIds(1);vtkIdType pId = this->Locator->FindClosestPoint(x);pIds->SetId(0, pId);return 1;
}vtkIdType vtkVoronoiKernel::ComputeWeights(double*, vtkIdList*, vtkDoubleArray* weights)
{weights->SetNumberOfTuples(1);weights->SetValue(0, 1.0);return 1;
}

vtkSPHKernel

描述:vtkSPHKernel是D.J. Price描述的光滑粒子流体动力学插值内核的抽象超类。

内核在采样点的半径所定义的空间上运行。核隐含地假设组成输入数据的粒子满足质量守恒等物理性质。因此,这个内核的子类通常不适用于插值过程,因此与vthSPHInterpolator类一起操作。

默认情况下,内核从空间步长^3计算局部粒子体积。

但是,如果同时提供可选的质量和密度数组,则使用它们来计算局部体积。

同样是默认的,插值点周围的局部邻域被计算为CutoffFactor * SpatialStep。(注意CutoffFactor对于每种类型的SPH内核是不同的。)但是,用户可以指定一个CutoffArray,使每个点的截断距离可变。

包含三个子类:vtkSPHCubicKernel、vtkSPHQuarticKernel、vtkSPHQuinticKernel。

VTK-vtkPointInterpolator/vtkInterpolatorKernel相关推荐

  1. VTK:网格之PointInterpolator

    VTK:网格之PointInterpolator VTK:网格之PointInterpolator 描述 代码 PointInterpolator.cxx CMakeLists.txt VTK:网格之 ...

  2. VTK:网格之InterpolateFieldDataDemo

    VTK:网格之InterpolateFieldDataDemo VTK:网格之InterpolateFieldDataDemo 描述 代码 InterpolateFieldDataDemo.cxx C ...

  3. vtk相机_C#开发PACS医学影像三维重建(一)使用VTK重建3D影像

    VTK简介: VTK是一个开源的免费软件系统,主要用于三维计算机图形学.图像处理和可视化.Vtk是在面向对象原理的基础上设计和实现的,它的内核是用C++构建的. 因为使用C#语言开发,而VTK是C++ ...

  4. cmake开发环境 linux qt_一步步搭建CMake+QT+VTK+BOOST开发环境

    开发环境: 1.可以迅速处理大量并发网络数据包,ASIO库和winpcap 4.1.3库; 2.处理与显示点云模型数据,使用VTK 8.2.0库; 3.项目使用CMake+VC2017编译,GUI使用 ...

  5. PCL调错(2):VTK报错

    为了解决这两个问题,一共做了两步操作: 第一:百度搜索结果是说我的lib库连接不对(就是VTK附加依赖项没有添加完整)比如把vtkRenderingOpenGL.lib库添加进去,所以又重新把vtk下 ...

  6. 2 vtk 编译_OpenCV4.2使用viz模块显示3D图像

    在OpenCV 3D视觉中如果需要显示三维数据或图像就需要用到viz模块,viz是OpenCV的3D显示模块,OpenCV官方release版本不包含此模块,需要我们自己cmake编译. Cmake步 ...

  7. win下使用QT添加VTK插件实现点云可视化GUI

    摘要​ 大家在做点云的时候经常会用到QT,但是我们需要使用QT做点云的可视化的时候又需要VTK,虽然我们在windows下安装PCL的时候就已经安装了VTK,由于跟着PCL安装的VTK是没有和QT联合 ...

  8. 基于VTK的Delaunay的三角剖分算法

    实现效果: 开发环境:VS2015 + VTK5.10 #define vtkRenderingCore_AUTOINIT 4(vtkInteractionStyle,vtkRenderingFree ...

  9. 安装mayavi和VTK库的血泪史

    一开始安装VTK库是从官网上下载,但是怎么都找不到whl文件,只有exe文件(vtkpython-7.1.1-Windows-64bit.exe).下载安装之后再PyCharm中import vtk出 ...

最新文章

  1. 创成汇2019年参加创新创业大赛都能获得什么?
  2. 百联OJ:2723:不吉利日期
  3. TCP/IP协议(二)tcp/ip基础知识
  4. 中富之命能有多少钱_做建筑师到底能赚多少钱?
  5. geetest文件夹什么意思_手机文件夹是英文不敢删?只要找出这5个文件夹,能腾出大量内存...
  6. 颜值即正义!颜值爆表的几个数据交互的库来啦!
  7. 自动化测试——何为自动化测试,为何自动化测试
  8. python 画ks曲线_风控模型—区分度评估指标(KS)深入理解应用
  9. 如何删除mysql系统服务_如何彻底删除mysql服务(清理注册表)详解
  10. 论文学习笔记-M2Det
  11. 《统计学基于R》第一章 数据与R
  12. Hadoop集群配置
  13. 微信公众号聊天底部菜单动画
  14. 浅谈framework之PowerManagerService
  15. MFC 执行顺序总结
  16. TLD 源码详解(一)--- TLD的编译和运行
  17. 以太坊区块同步成功标志
  18. Golang for循环
  19. 用Python解决x的n次方
  20. 新手教程:建立网站的全套流程与详细解释

热门文章

  1. 《电子商务》漫谈网络营销
  2. 手机号如何批量导入通讯录?
  3. 人工智能第五章知识总结
  4. Mac上一款天空效果合成图片处理软件分享
  5. 计算机控制技术基础试题,上海交大2004年计算机控制技术基础考试试题
  6. 联想y7000p2020H重装系统后少了各种驱动的解决办法。
  7. 实例讲解映像劫持的使用技巧——通过映像劫持实现Notepad2替换记事本
  8. [华容道]Python小程序(可自定义地图&带解密算法&详细代码注释)
  9. iOS6系统如何升级 菜鸟也能轻松上手
  10. [软件教程]专业屏幕捕捉软件 HyperSnap-DX 使用教程