vtk中用到的一些Filter(2)

vtkDataSetSurfaceFilter

示例:https://kitware.github.io/vtk-examples/site/Cxx/PolyData/DataSetSurfaceFilter/

Extracts outer (polygonal) surface.
提取外部(多边形)表面。

vtkDataSetSurfaceFilter is a faster version of vtkGeometry filter, but it does not have an option to select bounds. It may use more memory than vtkGeometryFilter. It only has one option: whether to use triangle strips when the input type is structured.
vtkDataSetSurfaceFilter 是 vtkGeometry 过滤器的更快版本,但它没有选择边界的选项。 它可能比 vtkGeometryFilter 使用更多的内存。 它只有一个选项:输入类型为结构化时是否使用三角条。

vtkDistancePolyDataFilter

示例:https://kitware.github.io/vtk-examples/site/Cxx/PolyData/DistancePolyDataFilter/

Computes the signed distance from one vtkPolyData to another.
计算从一个 vtkPolyData 到另一个的有符号距离。

The signed distance to the second input is computed at every point in the first input using vtkImplicitPolyDataDistance. Optionally, the signed distance to the first input at every point in the second input can be computed. This may be enabled by calling ComputeSecondDistanceOn().
使用 vtkImplicitPolyDataDistance 在第一个输入中的每个点计算到第二个输入的有符号距离。 可选地,可以计算第二个输入中每个点到第一个输入的有符号距离。 这可以通过调用 ComputeSecondDistanceOn() 来启用。

If the signed distance is not desired, the unsigned distance can be computed by calling SignedDistanceOff(). The signed distance field may be negated by calling NegateDistanceOn();
如果不需要有符号距离,则可以通过调用 SignedDistanceOff() 来计算无符号距离。 可以通过调用 NegateDistanceOn() 来否定带符号的距离字段;

vtkIntersectionPolyDataFilter

示例:https://kitware.github.io/vtk-examples/site/Cxx/PolyData/IntersectionPolyDataFilter/

vtkIntersectionPolyDataFilter computes the intersection between two vtkPolyData objects.
The first output is a set of lines that marks the intersection of the input vtkPolyData objects. This contains five different attached data arrays:
vtkIntersectionPolyDataFilter 计算两个 vtkPolyData 对象之间的交集。
第一个输出是一组标记输入 vtkPolyData 对象相交的线。这包含五个不同的附加数据数组:

SurfaceID: Point data array that contains information about the origin surface of each point

Input0CellID: Cell data array that contains the original cell ID number on the first input mesh

Input1CellID: Cell data array that contains the original cell ID number on the second input mesh

NewCell0ID: Cell data array that contains information about which cells of the remeshed first input surface it touches (If split)

NewCell1ID: Cell data array that contains information about which cells on the remeshed second input surface it touches (If split)

SurfaceID:点数据数组,包含有关每个点的原点表面的信息
Input0CellID:包含第一个输入网格上的原始单元 ID 号的单元数据数组
Input1CellID:包含第二个输入网格上的原始单元 ID 号的单元数据数组
NewCell0ID:单元格数据数组,包含有关重新划分网格的第一个输入表面的哪些单元格的信息(如果拆分)
NewCell1ID:单元格数据数组,包含有关在重新划分网格的第二个输入表面上它接触的单元格的信息(如果拆分)

The second and third outputs are the first and second input vtkPolyData, respectively. Optionally, the two output vtkPolyData can be split along the intersection lines by remeshing. Optionally, the surface can be cleaned and checked at the end of the remeshing. If the meshes are split, The output vtkPolyDatas contain three possible data arrays:
第二个和第三个输出分别是第一个和第二个输入 vtkPolyData。可选地,两个输出 vtkPolyData 可以通过重新网格化沿着相交线分割。可选地,可以在重新划分网格结束时清洁和检查表面。如果网格被分割,输出 vtkPolyDatas 包含三个可能的数据数组:

IntersectionPoint: This is a boolean indicating whether or not the point is on the boundary of the two input objects

BadTriangle: If the surface is cleaned and checked, this is a cell data array indicating whether or not the cell has edges with multiple neighbors A manifold surface will have 0 everywhere for this array!

FreeEdge: If the surface is cleaned and checked, this is a cell data array indicating if the cell has any free edges. A watertight surface will have 0 everywhere for this array!

IntersectionPoint:这是一个布尔值,指示该点是否在两个输入对象的边界上

BadTriangle:如果表面被清理和检查,这是一个单元格数据数组,指示单元格是否具有多个邻居的边缘。对于这个数组,流形表面处处都是 0!

FreeEdge:如果表面被清洁和检查,这是一个单元格数据数组,指示单元格是否有任何自由边缘。对于这个数组,一个不漏水的表面到处都是 0!

vtkRuledSurfaceFilter

示例:https://kitware.github.io/vtk-examples/site/Cxx/PolyData/RuledSurfaceFilter/

generates a surface from a set of lines
从一组线生成一个表面

vtkRuledSurfaceFilter is a filter that generates a surface from a set of lines. The lines are assumed to be “parallel” in the sense that they do not intersect and remain somewhat close to one another. A surface is generated by connecting the points defining each pair of lines with straight lines. This creates a strip for each pair of lines (i.e., a triangulation is created from two generating lines). The filter can handle an arbitrary number of lines, with lines i and i+1 assumed connected. Note that there are several different approaches for creating the ruled surface, the method for creating the surface can either use the input points or resample from the polylines (using a user-specified resolution).
vtkRuledSurfaceFilter 是一个从一组线生成表面的过滤器。这些线被假定为“平行”,因为它们不相交并且彼此保持一定程度的接近。通过用直线连接定义每对线的点来生成表面。这将为每对线创建一条带(即,从两条生成线创建三角剖分)。过滤器可以处理任意数量的行,假设第 i 行和第 i+1 行是连接的。请注意,创建规则曲面有多种不同的方法,创建曲面的方法可以使用输入点或从折线重新采样(使用用户指定的分辨率)。

This filter offers some other important features. A DistanceFactor ivar is used to decide when two lines are too far apart to connect. (The factor is a multiple of the distance between the first two points of the two lines defining the strip.) If the distance between the two generating lines becomes too great, then the surface is not generated in that region. (Note: if the lines separate and then merge, then a hole can be generated in the surface.) In addition, the Offset and OnRation ivars can be used to create nifty striped surfaces. Closed surfaces (e.g., tubes) can be created by setting the CloseSurface ivar. (The surface can be closed in the other direction by repeating the first and last point in the polylines defining the surface.)
此过滤器提供了一些其他重要功能。 DistanceFactor ivar 用于决定两条线何时相距太远而无法连接。 (该因子是定义条带的两条线的前两个点之间的距离的倍数。)如果两条生成线之间的距离变得太大,则不会在该区域中生成表面。 (注意:如果线条分离然后合并,则可以在曲面中生成一个孔。)此外,Offset 和 OnRation ivars 可用于创建漂亮的条纹曲面。可以通过设置 CloseSurface ivar 来创建闭合曲面(例如,管)。 (通过重复定义曲面的多段线中的第一个点和最后一个点,曲面可以在另一个方向上闭合。)

An important use of this filter is to combine it with vtkStreamTracer to generate stream surfaces. It can also be used to create surfaces from contours.
此过滤器的一个重要用途是将其与 vtkStreamTracer 结合以生成流表面。它还可用于从轮廓创建表面。

Warning
The number of lines must be greater than two if a surface is to be generated. sides (i.e., a ribbon), use vtkRibbonFilter.
警告
如果要生成曲面,线的数量必须大于两条。边(即功能区),使用 vtkRibbonFilter。

vtkElevationFilter

示例:https://kitware.github.io/vtk-examples/site/Cxx/Meshes/ElevationFilter/

generate scalars along a specified direction
沿指定方向生成标量

vtkElevationFilter is a filter to generate scalar values from a dataset. The scalar values lie within a user specified range, and are generated by computing a projection of each dataset point onto a line. The line can be oriented arbitrarily. A typical example is to generate scalars based on elevation or height above a plane.
vtkElevationFilter 是一个从数据集中生成标量值的过滤器。 标量值位于用户指定的范围内,并通过计算每个数据集点在一条线上的投影来生成。 线路可以任意定向。 一个典型的例子是根据平面以上的高度或高度生成标量。

Warning
vtkSimpleElevationFilter may be easier to use in many cases; e.g., compute vertical elevation above zero z-point.
警告
vtkSimpleElevationFilter 在很多情况下可能更容易使用; 例如,计算零 z 点以上的垂直高程。

vtkSimpleElevationFilter

示例:https://kitware.github.io/vtk-examples/site/Cxx/Meshes/SimpleElevationFilter/

generate scalars along a specified direction
沿指定方向生成标量

vtkSimpleElevationFilter is a filter to generate scalar values from a dataset. The scalar values are generated by dotting a user-specified vector against a vector defined from the input dataset points to the origin.
vtkSimpleElevationFilter 是一个从数据集中生成标量值的过滤器。 标量值是通过将用户指定的向量与从输入数据集点定义的向量点到原点来生成的。

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
### 回答1: vtk.js 是一个用于在网页显示和操作三维数据的 JavaScript 库。 它提供了许多过滤器,可以对三维数据进行操作,包括缩放、旋转、剪切、平移等。 要在 vtk.js 编写一个自定义的过滤器,需要先引入 vtk.js 库,然后创建一个新的过滤器类。 这个类应该继承自 vtk.js vtkImageAlgorithm 类,并实现它的 requestData 方法。 requestData 方法是过滤器的主要方法,在这个方法,可以通过调用 vtk.js 的函数来对输入的三维数据进行操作,然后将结果输出到输出端。 下面是一个简单的 vtk.js 过滤器的示例代码,它实现了一个简单的翻转图像的功能: ``` import vtk from 'vtk.js'; class FlipFilter extends vtk.Algorithm { constructor() { super(); this.setInputData(input); } requestData(inData, outData) { const input = inData[0]; const output = outData[0]; // 获取输入数据的维度信息 const dims = input.getDimensions(); const [width, height, depth] = dims; // 创建一个新的图像数据,并将输入数据的内容复制到新的图像数据 const outputData = vtk.DataArray.newInstance({ name: 'Output', numberOfComponents: 1, values: new Uint8Array(width * height * depth) }); outputData.copy(input.getPointData().getScalars()); // 对新的图像数据进行 ### 回答2: vtk.js是一个用于在Web浏览器进行可视化的JavaScript库。在vtk.jsfilter用于对数据进行处理和转换,以便在可视化使用。下面是一个关于vtk.jsfilter如何编写的简要步骤: 1. 导入所需的模块和类: ``` import vtk from 'vtk.js/Sources/vtk'; import vtkDataArray from 'vtk.js/Sources/Common/Core/DataArray'; import vtkPolyData from 'vtk.js/Sources/Common/DataModel/PolyData'; import vtkHedgehog from 'vtk.js/Sources/Filters/General/Hedgehog'; ``` 2. 创建输入数据: ``` const polyData = vtkPolyData.newInstance(); // 添加点和拓扑信息到polyData // ... ``` 3. 创建并配置过滤器: ``` const filter = vtkHedgehog.newInstance(); // 设置输入数据 filter.setInputData(polyData); // 设置其他参数,如放大因子、缩放因子等 // ... ``` 4. 执行过滤器: ``` filter.update(); ``` 5. 获取过滤器的输出: ``` const output = filter.getOutputData(); // 获取输出数据的各种属性,如点、拓扑、标量等 // ... ``` 通过以上步骤,在vtk.js就可以创建并使用filter对数据进行处理和转换,从而满足可视化的需求。需要根据具体的需求和数据类型选择合适的filter,并对其参数进行适当配置。vtk.js还提供了很多其他强大的filter,可以根据需要进一步探索和使用。 ### 回答3: vtk.js是一个用于生成可视化效果的开源 JavaScript 库,其filter是用于对数据进行处理、过滤和转换的功能模块。 在vtk.js使用filter主要有以下几个步骤: 1. 导入所需的filter模块:在使用vtk.js时,需要先导入所需要的模块,可以通过以下语句导入filter模块: ``` import vtk from 'vtk.js/Sources/vtk'; import vtkBoxClipDataSet from 'vtk.js/Sources/Filters/General/BoxClipDataSet'; ``` 在这个例子,我们导入了一个名为vtkBoxClipDataSet的filter模块。 2. 创建并配置filter:通过vtkBoxClipDataSet.create()方法创建一个filter实例,并通过设置其属性来配置filter,例如设置截取框的范围。 ``` const filter = vtkBoxClipDataSet.newInstance(); filter.setOutputDataSetTypeToUnstructuredGrid(); filter.setBox([minX, maxX, minY, maxY, minZ, maxZ]); ``` 在这个例子,我们使用vtkBoxClipDataSet.create()方法创建了一个vtkBoxClipDataSet的实例,并通过调用setOutputDataSetTypeToUnstructuredGrid()方法设置输出数据类型为UnstructuredGrid,然后使用setBox()方法设置了截取框的范围。 3. 设置输入数据:将需要处理的数据设置给filter的输入。 ``` filter.setInputData(inputData); ``` 在这个例子,我们通过setInputData()方法设置过滤器的输入数据为inputData变量。 4. 执行filter并获取结果:调用filter的update()方法来执行filter,并通过getOutputData()方法获取处理后的数据。 ``` filter.update(); const outputData = filter.getOutputData(); ``` 在这个例子,我们调用filter的update()方法来执行filter,并使用getOutputData()方法获取处理后的数据并存储在outputData变量。 这样,我们就完成了使用filter对数据进行处理的过程。最后可以根据需要对outputData进行可视化或其他操作。 总结起来,使用vtk.js的filter主要包括导入filter模块、创建并配置filter、设置输入数据、执行filter并获取结果等步骤。根据不同的filter功能和需求的不同,具体的使用方法可能会有所差异。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

努力减肥的小胖子5

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值