vtk

How to get the the values of a vtkDoubleArray in a std::vector

眉间皱痕 提交于 2019-12-11 01:29:34
问题 I want to copy the elements of a vtkDoubleArray into a C++ std::vector (as in How to convert a vtkDoubleArray to an Eigen::matrix) I am trying to get this to work: typedef std::vector<double> row_type; typedef std::vector<row_type> matrix_type; int n_components = vtk_arr->GetNumberOfComponents(); int n_rows = vtk_arr->GetNumberOfTuples(); row_type curTuple(n_components); matrix_type cpp_matrix(n_rows, row_type(n_components)); for (int i=0; i<n_rows; i++) { vtk_arr->GetTuple(i, curTuple); cpp

Difference between vertex and point in vtk

筅森魡賤 提交于 2019-12-11 01:17:54
问题 What's the main difference between a vertex and a point in VTK? Well, I was assigning some computed points to an vtkPolyData output: vtkPolyData* oput = vtkPolyData::SafeDownCast(out_info->Get(vtkDataObject::DATA_OBJECT())); and I wondered whether to use the method SetVerts(vtkCellArray *v) or the method SetPoints(vtkPoints *) . 回答1: In VTK datasets (i.e., classes inheriting vtkDataSet which is the simplest type of data that provides a notion of points), points are simply locations in space.

Error with vtkRenderer

泪湿孤枕 提交于 2019-12-11 00:58:28
问题 I'm new to vtk, so I started by building vtk 8.1.1 with CMake and Visual Studio 2017, with the default options and the examples. Many of the examples runs fine, but some of them gives an error: This one is the CreateTree example, but the HelloWorld gives the same error. I don't know if it has something to do with this issue. I've also tried the solution from this question and this one. But when I add #include <vtkAutoInit.h> VTK_MODULE_INIT(vtkRenderingOpenGL2); right after all the includes,

How to store a vector field with VTK? C++, VTKWriter

好久不见. 提交于 2019-12-11 00:38:17
问题 Let's say, I have a vector field u, with components ux, uy and uz, defined at (unstructured) positions in space rx, ry and rz. All I want, is to store this vector field with the VTK format, i.e. with the class "vtkwriter" from libvtk to enable visualization with Paraview. I think I got the code for incorporating the positions right, but somehow I can't figure out, how to incorporate the data: #include <vtkPoints.h> #include <vtkPolyDataWriter.h> #include <vtkSmartPointer.h> void write_file

how to write multiple vtkUnstructuredGrid in one .vtu file

ぃ、小莉子 提交于 2019-12-10 23:08:35
问题 I want to write multiple unstructured grids in one .vtu file. I tried below. MakeHexagonalPrism() and MakeHexahedron() return vtkSmartPointer type. The result is there was only one unstructured grid in the output file. vtkSmartPointer<vtkXMLUnstructuredGridWriter> writer = vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New(); writer->SetFileName(filename.c_str()); writer->SetInputData(MakeHexagonalPrism()); writer->SetInputData(MakeHexahedron()); writer->Write(); I also tried below. The type

QVTKOpenGLWidget and vtkGenericOpenGlRenderWindow with QTDesigner

倾然丶 夕夏残阳落幕 提交于 2019-12-10 19:35:11
问题 I'm trying to use QVTKOpenGLWidget in QTDesigner with vtkGenericOpenGlRenderWindow but I obtain a black window. When I use PCLVizualizer of PointCloud Library (PCL) with vtkGenericOpenGlRenderWindow , everything works fine. I'm trying to create a custom viewer the same way as PCL. QMainPanel::QMainPanel( HWND hWnd ) : QWinWidget( hWnd ), ui(new Ui::QMainPanel) { ui->setupUi(this); rendererTest = vtkSmartPointer<vtkRenderer>::New(); rendererTest->GradientBackgroundOn(); rendererTest-

vtk.vtkRender() causes seg fault:11

你离开我真会死。 提交于 2019-12-10 14:30:18
问题 I have a python script, which I didn't write, that utilises the vtk module. It has worked on my old iMac and on my Linux machines. Trying it on my Macbook Pro with OS X Mavericks installed I get a seg fault during rendering. I have tracked down the error to a call to the vtkRender() method which causes the script to crash with seg fault 11. I literally have no idea how to go further and find out the exact cause of the bug (for instance, how do I step into a method call using pdb?), any ideas?

Insert VTK into the right spot of layout

邮差的信 提交于 2019-12-10 12:15:46
问题 I am trying to put the VTK 3D scene widget into the right spot of pyqtgraphics.GraphicsLayout(). But either the scene does not appear if i am not assigning the window as parent or if I do - the scene does not adapt to the free area, it is just floating in the upper left corner. I am currently struggling to find a solution to put a viewbox and vtkrenderer into the same window. One of my attempts was to assign the self.w (see below this paragraph)- which is my main window as a parent to the

intergrating qt4 ,vtk and visual studio2010

删除回忆录丶 提交于 2019-12-10 12:15:38
问题 I have an integrated visual studio (2010) and Qt(4 visual studio addin) combination and just recently decided to add VTK5.I have managed to compile VTK as per the numerous instructions everywhere .However i tried to build a simple example from the VTK website but i get the Dll errors below.I have added include paths in visual studio but just can't compile .please direct me on what i should do next . GeneratedFiles\Debug\moc_QVTKWidget.cpp(73): warning C4273: 'staticMetaObjectExtraData' :

error LNK2001 when including “pcl_visualizer.h”

久未见 提交于 2019-12-10 11:54:03
问题 I want to visualize a point cloud using the point-cloud-library. I already included: #include <pcl/point_types.h> #include <pcl/io/pcd_io.h> #include <pcl/kdtree/kdtree_flann.h> #include <pcl/features/normal_3d.h> #include <pcl/surface/gp3.h> without any problem, but when I add #include <pcl/visualization/pcl_visualizer.h> to my code I receive an LNK2001 error. Fehler 51 error LNK2001: Nicht aufgelöstes externes Symbol ""public: virtual void __cdecl pcl::visualization::PCLVisualizer: