vtk

VTK 图像画布

自闭症网瘾萝莉.ら 提交于 2021-01-17 13:02:37
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <vtkAutoInit.h> VTK_MODULE_INIT(vtkRenderingOpenGL2) VTK_MODULE_INIT(vtkInteractionStyle) #include <vtkSmartPointer.h> class vtkRenderer; class vtkImageCanvasSource2D; class vtkImageData; class vtkImageViewer2; namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = nullptr); ~MainWindow(); private: vtkSmartPointer<vtkRenderer> pRenderer; vtkSmartPointer<vtkImageViewer2> pImageViewer; vtkSmartPointer<vtkImageCanvasSource2D> pImageCanvas; //

VTK 观察者&命令模式: vtkCallbackCommand

好久不见. 提交于 2021-01-17 09:48:26
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <vtkAutoInit.h> VTK_MODULE_INIT(vtkRenderingOpenGL2) VTK_MODULE_INIT(vtkInteractionStyle) #include <vtkSmartPointer.h> class vtkRenderer; class vtkImageViewer2; class vtkObject; class vtkCallbackCommand; namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = nullptr); ~MainWindow(); public: void updateMousePosInfo(const QString& mousePosInfo); private slots: void openFileSlot(); private: // 注意必须为静态函数 static void updateCoords(vtkObject* obj,

QT Vtk 显示MHD图像

笑着哭i 提交于 2021-01-17 09:45:08
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <vtkAutoInit.h> VTK_MODULE_INIT(vtkRenderingOpenGL2) VTK_MODULE_INIT(vtkInteractionStyle) #include <vtkSmartPointer.h> class vtkRenderer; class vtkImageViewer2; namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = nullptr); ~MainWindow(); private slots: void openFileSlot(); private: vtkSmartPointer<vtkRenderer> pRenderer; vtkSmartPointer<vtkImageViewer2> pImageViewer; private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H #include "mainwindow.h"

Setting up VTK, with python3.8 and Ubuntu 20.04

折月煮酒 提交于 2020-12-26 04:02:48
问题 I recently updated my system to Ubunutu 20.04, and my python is now 3.8. Since then all my import vtk lines don't work, ModuleNotFoundError: No module named 'vtk' I have tried apt-get python-vtk , pip3 install vtk and pretty much all the standard terminal install commands. Without fail they all are unable to locate the package. I have been searching for ways to sort this out all over the net, but without success. I am familiar with building Kitware (Cmake and Paraivew) stuff from source so I

Setting up VTK, with python3.8 and Ubuntu 20.04

喜你入骨 提交于 2020-12-26 04:02:05
问题 I recently updated my system to Ubunutu 20.04, and my python is now 3.8. Since then all my import vtk lines don't work, ModuleNotFoundError: No module named 'vtk' I have tried apt-get python-vtk , pip3 install vtk and pretty much all the standard terminal install commands. Without fail they all are unable to locate the package. I have been searching for ways to sort this out all over the net, but without success. I am familiar with building Kitware (Cmake and Paraivew) stuff from source so I

Setting up VTK, with python3.8 and Ubuntu 20.04

扶醉桌前 提交于 2020-12-26 04:01:02
问题 I recently updated my system to Ubunutu 20.04, and my python is now 3.8. Since then all my import vtk lines don't work, ModuleNotFoundError: No module named 'vtk' I have tried apt-get python-vtk , pip3 install vtk and pretty much all the standard terminal install commands. Without fail they all are unable to locate the package. I have been searching for ways to sort this out all over the net, but without success. I am familiar with building Kitware (Cmake and Paraivew) stuff from source so I

Convert STL object to VTK geometry in python

廉价感情. 提交于 2020-12-15 04:33:08
问题 I am wanting to do Boolean operations on STL files with geometric primitives from the VTK library. My problem is converting the STL geometry to something that the VTK Boolean objects will except. I tried the following... import vtk filename = 'gyroid.stl' reader = vtk.vtkSTLReader() reader.SetFileName(filename) mapper = vtk.vtkPolyDataMapper() mapper.SetInputConnection(reader.GetOutputPort()) gyroid = vtk.vtkActor() gyroid.SetMapper(mapper) sphere = vtk.vtkSphere() sphere.SetRadius(30) sphere

VTK Boolean operations on poly data producing empty sets

北战南征 提交于 2020-12-15 01:50:25
问题 I have an STL of a gyroid & I want to crop it with a sphere (previous question) Now I have the data represented in the correct manner but whenever I do a Boolean operation on my 2 objects I get an empty result. import vtk colors = vtk.vtkNamedColors() file_name = 'gyroid.stl' # Load poly from STL reader = vtk.vtkSTLReader() reader.SetFileName(file_name) reader.Update() polyData = reader.GetOutput() # Centre of poly x = (polyData.GetBounds()[1] - polyData.GetBounds()[0]) / 2.0 y = (polyData

VTK Boolean operations on poly data producing empty sets

…衆ロ難τιáo~ 提交于 2020-12-15 01:47:13
问题 I have an STL of a gyroid & I want to crop it with a sphere (previous question) Now I have the data represented in the correct manner but whenever I do a Boolean operation on my 2 objects I get an empty result. import vtk colors = vtk.vtkNamedColors() file_name = 'gyroid.stl' # Load poly from STL reader = vtk.vtkSTLReader() reader.SetFileName(file_name) reader.Update() polyData = reader.GetOutput() # Centre of poly x = (polyData.GetBounds()[1] - polyData.GetBounds()[0]) / 2.0 y = (polyData

VTK Boolean operations on poly data producing empty sets

末鹿安然 提交于 2020-12-15 01:44:06
问题 I have an STL of a gyroid & I want to crop it with a sphere (previous question) Now I have the data represented in the correct manner but whenever I do a Boolean operation on my 2 objects I get an empty result. import vtk colors = vtk.vtkNamedColors() file_name = 'gyroid.stl' # Load poly from STL reader = vtk.vtkSTLReader() reader.SetFileName(file_name) reader.Update() polyData = reader.GetOutput() # Centre of poly x = (polyData.GetBounds()[1] - polyData.GetBounds()[0]) / 2.0 y = (polyData