- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
以下代码片段配置了一个 python/VTKFloatArray,以便将来填充单位立方体的顶点坐标。设置 3 个分量 (x,y,z) 的 8 个元组。看来二传手不通勤。这是预期的行为吗?似乎必须首先设置组件的数量。有人能重现这个吗?谢谢您的回答
import vtk
import numpy as np
from itertools import product as itprod
vertices = np.array(list(itprod([0, 1], repeat=3)))
print vertices.shape[0] //8 vertices
print vertices.shape[1] //3 coordinates x-y-z
array = vtk.vtkFloatArray()
array.SetNumberOfComponents(vertices.shape[1])
array.SetNumberOfTuples(vertices.shape[0])
print array // number of tuples is 8, number of components is 3 OK
array = vtk.vtkFloatArray()
array.SetNumberOfTuples(vertices.shape[0])
array.SetNumberOfComponents(vertices.shape[1])
print array // number of tuples is 2 number of components is 3 WRONG
最佳答案
VTK 总是善变的,尤其是在文档方面。我在SetNumberOfTuples
上找到了一些信息和SetNumberOfComponents
在相应的链接。
前者(SetNumberOfTuples
):
Set the number of tuples (a component group) in the array.
Note that this may allocate space depending on the number of components. [...]
后者(SetNumberOfComponents
):
Set/Get the dimension (n) of the components.
Must be >= 1. Make sure that this is set before allocation.
据我所知,前者可以分配空间,但后者必须在任何分配之前调用。所以,他们确实不通勤,你需要先调用后者,这应该是工作顺序(这与你的结果一致)。
这些链接显然与 python 实现不对应,但事实上 C++ 版本不应该交换,因此您也不应该期望 python 中的交换性。
关于python - vtk/python VTKFloatArray 元组和组件的 setter 不交换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40824954/
当我使用 vtkPolyDataWriter 创建 vtk 遗留文件时,我获得了具有连接性和偏移量的新版本数据文件 (5.1)。是否可以更改它并获得“遗留”旧格式? gmsh 似乎无法读取新格式版本的
我有一个不规则数据,x 维 - 384,y 维 - 256 和 z 维 64。现在这些坐标存储在 3 个单独的二进制文件中,我有一个数据文件,其中包含这些点的数据值。我想知道,我如何表示这样的数据以便
所以我有一个点,并在 z 轴上创建一条线以查看与某个网格的交点(将网格上的点投影到 z 轴上)。 所以我创建了一个 vtkCellLocator,但是函数的每个参数是什么?文档中根本没有描述它: in
我想将旧版 .vtk 文件转换为二进制文件,最好是 .vtu 文件,因为我使用的是非结构化网格。为此,我改编了来自 http://www.vtk.org/Wiki/VTK/Examples/Cxx/I
我想在 paraview 中可视化一些图形:一堆带有坐标的点,它们之间有一堆边。我还想给点和边线上色。我认为这对 vtk 格式来说并不难,因为我发现 vtk 格式示例几乎有我需要的东西。 据我所知,p
我想将旧版 .vtk 文件转换为二进制文件,最好是 .vtu 文件,因为我使用的是非结构化网格。为此,我改编了来自 http://www.vtk.org/Wiki/VTK/Examples/Cxx/I
我有与 VTK 集成的 Visual Studio MFC 项目。单击我的项目上的按钮将生成一个 VTK 窗口,当我第二次单击同一按钮并打开一个新的 VTK 窗口时,我想关闭该 VTK 窗口。 我当前
当我尝试在 ParaView 中加载大小约为 100mb 的 VTK 文件时,程序崩溃了。但是,如果我通过选择更少的数据点(现在平均大小约为 30mb)来减小文件的大小,它会毫无问题地加载。 我不确定
我在 3D numpy.ndarray 中有一个分段,我想将其渲染到 VTK 中。 [参见这里类似的过程:https://pyscience.wordpress.com/2014/11/16/volu
我已遵循介绍指南:https://kitware.github.io/vtk-js/docs/develop_requirement.html安装 vtk、node 和 git。 我一直在尝试集成到
在我的计算过程中,我保存了一堆与单个时间步长相关的 .vtk 文件。每个文件都使用 POLYDATA ASCII 文件格式描述一个多面体(我定义的一个 C++ 类)。多面体由多面体类的一个简单成员函数
目前,我们正在使用 Python 的 vtk 包装器和 Pyvista(一个更 pythonist 的 vtk 包装器)。 在过程的某些部分,我们有一些来自 .cxx 文件的日志行: 2022-03-
当我使用 mayavi (4.3.1) 可视化网格时,它会提示以下警告: 警告:导入的 VTK 版本 (5.1) 与使用的版本不匹配 构建 TVTK 类 (6.3)。这可能会导致问题。 请重建TVTK
我正在尝试将计算标量添加到现有 VTK 文件中。 我的代码的简化版本如下 import vtk import os import numpy as np reader = vtk.vtkDataSet
对于当前的项目,我必须使用矩阵中提供的信息并对其进行数学计算,以及使用 ITK/VTK 函数来显示医疗信息/渲染。基本上我必须以(我猜)50/50 的方式同时使用 matlab 例程和 VTK/ITK
我有一条小 python VTK计算嵌入在 TIFF 图像堆栈中的对象的体积和表面积的函数。为了将 TIFF 的 读入 VTK,我使用了 vtkTIFFReader 并使用 vtkImageThres
目前,我正在尝试结合使用 VTK 库和 Qt 来构建一个可视化 STL 文件的应用程序。为了开始,我安装了以下库/程序: Visual Studio 2015 专业版 CMake 3.7.0 VTK
如何获取数据集的范围?也称为数据的边界框。使用 StructuredPointsReader 读取数据. 最佳答案 因为 vtkStructuredPoints(vtkStructuredPoints
我正在尝试使用分析字段填充结构化网格,但是尽管阅读了vtk文档,但我还没有找到如何在网格点上实际设置标量值或设置网格的间距/原点信息的方法。从下面的代码开始,我该如何 将空间信息与网格相关联(即,单元
CGAL和VTK库之间有什么区别?两者都包含许多标准几何算法。谁能列出一些优先于另一个的应用程序域? 最佳答案 VTK主要针对可视化(前端)。它不方便地包含一些计算几何函数(例如Delaunay三角剖
我是一名优秀的程序员,十分优秀!