vtk

vtkStandardNewMacro gives error C4430: missing type specifier

只谈情不闲聊 提交于 2019-12-02 06:09:47
问题 I have the following code: #include <vtkInteractorStyleTrackballCamera.h> class InteractorStyle : public vtkInteractorStyleTrackballCamera { public: static InteractorStyle* New() {}; vtkTypeMacro(InteractorStyle, vtkInteractorStyleTrackballCamera); InteractorStyle() { cout << "test"; } virtual void OnLeftButtonDown(); virtual void OnKeyPress(); private: }; vtkStandardNewMacro(InteractorStyle); //error here void InteractorStyle::OnLeftButtonDown() { std::cout << "test"; // Forward events

how to connect ITK to VTK with c++?

穿精又带淫゛_ 提交于 2019-12-02 01:46:15
问题 I am a beginner in ITK, VTK and Qt. I use visual studio 9. I am trying to read a DICOM series with ITK and display with VTK in QVTKWidget (Qt). I based on this code http://www.itk.org/Wiki/VTK/Examples/Cxx/IO/ReadDICOMSeries and I modified according to my needs. when I read the series DICOM with VTK and display it in QVTKWidget it works, but when I want to read this series with ITK and display with VTK in QVTKWidget, the program displays the first image of series and when I go to the next

Install VTK with anaconda 3.6

一曲冷凌霜 提交于 2019-12-01 23:54:43
I need to install VTK and mayavi on Ubuntu 16. I have Anaconda with Python 3.6. If I run: conda install -c menpo vtk=7.0.0 vtk I get: Fetching package metadata ........... Solving package specifications: . UnsatisfiableError: The following specifications were found to be in conflict: - python 3.6* - vtk 7.0.0* -> python 3.5* -> openssl 1.0.1* - vtk 7.0.0* -> python 3.5* -> xz 5.0.5 Use "conda info <package>" to see the dependencies for each package. Apparently, I need Anaconda with Python3.5, but it's not availabe. Any idea? :) You can also use this: https://anaconda.org/clinicalgraphics/vtk

how to connect ITK to VTK with c++?

安稳与你 提交于 2019-12-01 22:01:19
I am a beginner in ITK, VTK and Qt. I use visual studio 9. I am trying to read a DICOM series with ITK and display with VTK in QVTKWidget (Qt). I based on this code http://www.itk.org/Wiki/VTK/Examples/Cxx/IO/ReadDICOMSeries and I modified according to my needs. when I read the series DICOM with VTK and display it in QVTKWidget it works, but when I want to read this series with ITK and display with VTK in QVTKWidget, the program displays the first image of series and when I go to the next image with the mouse wheel, the program crashes. when I debugged, I got this error: void

Converting between VTK framebuffer and OpenCV Mat data

早过忘川 提交于 2019-12-01 21:42:15
问题 I am visualizing data in VTK and I want to grab the framebuffer of the renderwindow and show it in an OpenCV application. I am currently attempting this through: void aig::VirtualScene::Mat(cv::Mat &m) { typedef unsigned char pixel; pixel *pixels = this->window_->GetRGBACharPixelData(0, 0, this->w_, this->h_, true); m = cv::Mat(this->h_, this->w_, CV_8UC4, pixels); } But I am ending up with a distorted image: (both upside down and slanted, which I assume is a step issue. Is there an obvious

vtkRenderWindowInteractor event loop and threading

坚强是说给别人听的谎言 提交于 2019-12-01 20:11:56
What I am trying to do in an application using vtk for both interacting and rendering is to have two different parts: 1 - A thread with Rendering and vtkRenderWindowInteractor for interaction with mouse. 2 - A thread that call some modifier functions of the data defined in the VTK Thread. From what I've gotten so far in my research it seems rather complicated and VTK is not thread safe. Now I've stumbled upon this post ( http://vtk.1045678.n5.nabble.com/Multi-threaded-VTK-td4514620.html ) on the VTK mailing list that suggests using Qt Signals and Slots. A first question would be is that still

CMake: Run-time error (dyld: Library not loaded) for dynamically linked resources on MacOS

和自甴很熟 提交于 2019-12-01 06:48:13
Problem On MacOS, I get linking problems at runtime for a CMake project that depends on dynamically linked resources – but only after installing the project! The problem does not occur when I only build the binary without installing it. $ ./testapp Hello world! $ $INSTALLDIR/testapp dyld: Library not loaded: @rpath/libvtkDomainsChemistryOpenGL2-7.1.1.dylib Referenced from: /Users/normanius/workspace/installdir/testapp Reason: image not found [1] 76964 trace trap /Users/normanius/workspace/installdir/testapp Minimum example I am able to reproduce the problem in a minimal setup consisting of

Mayavi points3d with different size and colors

北城以北 提交于 2019-12-01 02:45:39
Is it possible in mayavi to specify individually both the size and the colors of every point? That API is cumbersome to me. points3d(x, y, z...) points3d(x, y, z, s, ...) points3d(x, y, z, f, ...) x, y and z are numpy arrays, or lists, all of the same shape, giving the positions of the points. If only 3 arrays x, y, z are given, all the points are drawn with the same size and color. In addition, you can pass a fourth array s of the same shape as x, y, and z giving an associated scalar value for each point, or a function f(x, y, z) returning the scalar value. This scalar value can be used to

Binary VTK for RECTILINEAR_GRID from fortran code

谁说胖子不能爱 提交于 2019-12-01 01:43:21
I am having a fortran code to generate a grid in binary VTK format. This code produces a binary VTK file like this one: # vtk DataFile Version 3.0 vtk output BINARY DATASET RECTILINEAR_GRID DIMENSIONS 2 2 1 X_COORDINATES 2 float ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@ Y_COORDINATES 2 float ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@ Z_COORDINATES 1 float ^@^@^@^@^@^@^@^@ When, I try to open it with ParaView it crashes with the following error message: ERROR: In /home/user/OpenFOAM/ThirdParty-2.3.0/ParaView-4.1.0/VTK/IO/Legacy/vtkRectilinearGridReader.cxx, line 311 vtkRectilinearGridReader (0x379f4b0):

How to display point cloud in vtk in different colors?

柔情痞子 提交于 2019-11-30 21:43:35
I have a point cloud which I want to visualize in vtk. I want to see them in different colors depending on some conditions. I am using python. Any suggestions on how to do that? Thanks a lot Here is an example that sets the point color based on z-axis value. import vtk from numpy import random class VtkPointCloud: def __init__(self, zMin=-10.0, zMax=10.0, maxNumPoints=1e6): self.maxNumPoints = maxNumPoints self.vtkPolyData = vtk.vtkPolyData() self.clearPoints() mapper = vtk.vtkPolyDataMapper() mapper.SetInputData(self.vtkPolyData) mapper.SetColorModeToDefault() mapper.SetScalarRange(zMin, zMax