vtk

How to visualize a sequence of TOF-Sensor data in PCL (with Qt)?

狂风中的少年 提交于 2020-01-02 19:29:27
问题 I've this TOF-sensor and I want to visualize the sensor's data as a point-cloud in Qt. I converted the data into a pcl::PointCloud and now I want to visualize it. The API of the sensor would emit a picture whenever one was created. And I would send it to the QVTKWidget to visualize it. And I tried it with this snippet of code (which I got from here): pcl::visualization::PCLVisualizer pvis ("test_vis", false); // 'false' prevents PCLVisualizer's own window to pop up pvis.addPointCloud<pcl:

Error writing binary VTK files

元气小坏坏 提交于 2020-01-02 14:53:21
问题 I am trying to write a basic binary VTK file to display some data using ParaView but I have some errors and I don't understand why. Here is my test code in C++: #include <iostream> #include <fstream> double myarray[72] = { 0,0,0,1,0,0,2,0,0,3,0,0,4,0,0, 5,0,0,0,1,0,1,1,0,2,1,0,3,1,0, 4,1,0,5,1,0,0,2,0,1,2,0,2,2,0, 3,2,0,4,2,0,5,2,0,0,3,0,1,3,0, 2,3,0,3,3,0,4,3,0,5,3,0}; int main() { std::ofstream vtkstream("test01.vtk", std::ios::out | std::ios::trunc); bool ascii = false; if (vtkstream) {

Am I missing step in building/installing VTK-5.4 with Python2.6 bindings on Ubuntu 9.04?

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-02 07:49:09
问题 I successfully built and installed VTK-5.4 with Python bindings from source. Yet, when I try to import VTK in python it gives the following Traceback error File "", line 1, in File "/usr/local/lib/python2.6/dist-packages/VTK-5.4.2-py2.6.egg/vtk/ init .py", line 41, in from common import * File "/usr/local/lib/python2.6/dist-packages/VTK-5.4.2-py2.6.egg/vtk/common.py", line 7, in from libvtkCommonPython import * ImportError: libvtkCommonPythonD.so.5.4: cannot open shared object file: No such

Python DLL import error when importing vtk

巧了我就是萌 提交于 2020-01-02 07:29:41
问题 I need to use the VTK library (with version 5.10 because I am working on an existing code) in python on my Windows 10 machine but I can not manage to import it without DLLImport error: Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:19:22) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import vtk Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python27\lib\site-packages\vtk\__init__.py", line

Copy vtkImageData to cv::Mat

末鹿安然 提交于 2020-01-02 06:00:31
问题 I am trying to copy a vtkImageData* class to a cv::Mat structure [my goal is to read an MHD file into OpenCV].. The file is essentially a 3D Matrix so I want to get a vector containing all the slices of the volume. So far, I have come up with this code, reader->SetFileName(INPUT_DATA_1.c_str()); reader->Update(); imageData_1 = reader->GetOutput(); extractVOI->SetInput(imageData_1); int dims[3]; imageData_1->GetDimensions(dims); extractVOI->SetVOI(0, dims[0], 0, dims[1], 75, 75); // Set it to

How to visualize 3D delaunay triangulation in Python?

假装没事ソ 提交于 2020-01-02 05:45:32
问题 I have a set of 3D points which I've used scipy.spatial.Delaunay to do the triangulation / tetrahedralization. I now have a set of unique faces of all of the tetrahedra, and would like to visualize these in 3D. Are there any Python libraries (or libraries with a Python wrapper) that can do this? 回答1: Try mayavi.mlab.triangular_mesh() import numpy as np from mayavi import mlab vertices = np.array([[0, 1, 0, 0],[0, 0, 1, 0],[0, 0, 0, 1]]) faces = np.array([[0, 1, 0, 0],[1, 2, 1, 2],[2, 3, 3, 3]

Save data to VTK using Python and tvtk with more than one vector field

感情迁移 提交于 2020-01-02 05:24:08
问题 I'm trying to save three sets of vector quantities corresponding to the same structured grid (velocity, turbulence intensity and standard deviation of velocity fluctuations). Ideally, I'd like them to be a part of the same vtk file but so far I have only been able to get one of them into the file like so: sg = tvtk.StructuredGrid(dimensions=x.shape, points=pts) sg.point_data.vectors = U sg.point_data.vectors.name = 'U' write_data(sg, 'vtktestWake.vtk') I've spent past few hours searching for

CMake could not find the VTKConfig.cmake

ぐ巨炮叔叔 提交于 2020-01-02 04:52:05
问题 I'm trying to compile a program in CMake but I'm getting this error. By not providing "FindVTK.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "VTK", but CMake did not find one. Could not find a package configuration file provided by "VTK" (requested version 6.1) with any of the following names: VTKConfig.cmake vtk-config.cmake I can't find the relevant files (VTKConfig.cmake or vtk-config.cmake) on the machine but do have VTKConfig

How to get the key code in a vtk KeyPressEvent using python

谁说我不能喝 提交于 2020-01-01 07:32:47
问题 I'm getting started with vtk (6) in python and have a problem handling KeyPressEvent. I want to subclass the vtkInteractorStyleTrackballCamera if I use this pattern, my interactor style does not have getKeySym() and I can't decode what key was pressed class KeyPressInteractorStyle(vtk.vtkInteractorStyleTrackballCamera): def __init__(self,parent=None): self.AddObserver("MiddleButtonPressEvent",self.middleButtonPressEvent) self.AddObserver("MiddleButtonReleaseEvent",self

VTK window thread from main thread, C++

好久不见. 提交于 2020-01-01 06:18:20
问题 I am just learning VTK (and C++ GUI programming) and have hopefully simple question. The main application launches rendered window at some point in application. Would like to be able for the main thread to continue, while VTK window is displayed. Is there a particular method to launch VTK window as a thread? My environment is Linux, with boost and pthreads at my disposal. Thanks. VTK is visualization toolkit, see vtk.org 回答1: You can call vtkRenderWindowInteractor->Start() method. (Get the