[vs+qt] Use the VTK library to read the STL model and display the STL model on the QT interface

Article directory summary Show results Implementation steps Code summary summary Summary To use the complete interface, click the button to select the file, read the stl three-dimensional model, and display the model on the qvtkWidget control. Effect display 1.Select the file address 2. Interface window display Implementation steps 1. Click the Open File button, select […]

Pyvista reads VTK files to render 3D cloud images and slice and crop them (1)

Pyvista official documentation: https://qtdocs.pyvista.org/index.html The following code was written by me after checking the official documentation API, and it contains the translation of the official API. The notes are very detailed, so the author won’t go into details. Three-dimensional cloud drawing effect: Surface: Surface + Mesh: Gridlines: Surface Points + Right-click to select Show Data: […]

VTK+QT implementation, displaying three two-dimensional three-dimensional views of the three-dimensional model

The renderings are as follows: This code uses QT and VTK libraries to display three three-dimensional views of the three-dimensional model on the interface. First, read the NIFTI image data through vtkNIFTIImageReader, and then create three rendering windows (coronal, sagittal, and axial views) to display images of the coronal, sagittal, and axial views respectively. Next, […]

VTK OrientationMarker direction three-dimensional coordinate system camera coordinate axis custom coordinate axis

This article is developed in Python language When we develop 3D software, we often use the camera coordinate axis to indicate the current spatial position; Coordinate axis effect: Camera direction coordinate axis Cube coordinate axis Custom axis: Code: Axes def main(): colors = vtkNamedColors() # create a Sphere sphereSource = vtkSphereSource() sphereSource.SetCenter(0.0, 0.0, 0.0) sphereSource.SetRadius(0.5) […]

[VTK] About the series of functions of VTK images

I’m very happy to meet you in Xueyi’s CSDN, and give you Tangtang Welcome to joinXueyi Community-CSDN Community Cloud Foreword This article summarizes the series of image functions in VTK, including image import (read), display, interaction and export (save). Detailed explanation of various solution ideas provided in VTK, friends can get it on demand! Thank […]

C++ Qt/VTK assembly forms a linkage connecting rod

Effect Key code #include “View3D.h” #include “Axis.h” #include <vtkActor.h> #include <vtkAppendPolyData.h > #include <vtkAreaPicker.h> #include <vtkAxesActor.h> #include <vtkBox.h> #include <vtkCamera.h> #include <vtkCaptionActor2D.h> #include <vtkCellArray.h> #include <vtkCleanPolyData.h> #include <vtkContourFilter.h> #include <vtkCubeSource.h> #include <vtkCylinder.h> #include <vtkCylinderSource.h> #include <vtkDataSet.h> #include <vtkGenericOpenGLRenderWindow.h> #include <vtkImplicitBoolean.h> #include <vtkInteractorStyleTrackballCamera.h> #include <vtkLine.h> #include <vtkMinimalStandardRandomSequence.h> #include <vtkNamedColors.h> #include <vtkObjectFactory.h> #include <vtkOrientationMarkerWidget.h> #include <vtkPlane.h> #include […]

pcl+vtk (9) QVTKOpenGLNativeWidget displays point cloud and model at the same time

1. Load point cloud pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>); //Create point cloud pointer QString fileName = QFileDialog::getOpenFileName(this, “Open PointCloud”, “.”, “Open PCD files(*.pcd)”); if(fileName == “”) return; pcl::io::loadPCDFile(fileName.toStdString(),*cloud); vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New(); vtkSmartPointer<vtkCellArray> vertices = vtkSmartPointer<vtkCellArray>::New(); for (int i = 0; i<cloud->size(); i + + ) { vtkIdType pid[1]; pid[0] = points->InsertNextPoint(cloud->at(i).x, cloud->at(i).y, cloud->at(i).z); vertices->InsertNextCell(1, pid); } […]

vtk [vtkPolyData, vtkCell, vtkPoints]

Article directory 1. vtkPolyData, cell, point 1) Example 2) vtkPolyData, vtkCell, vtkPoints 2. The difference between vtkNew and vtkSmartPointer: 3. Supplement 4. A simple method to determine whether the topological structures of the two are consistent 1. vtkPolyData, cell, point 1) Example /** * vtkNew is a class template * vtkNew<> is a simple RAII […]

[VTK] Bounding box and minimum bounding box

I’m very happy to meet you in Xueyi’s CSDN, and give you some sweets Welcome to joinXueyi Community-CSDN Community Cloud Foreword This article shares the technology of creating bounding boxes and minimum bounding boxes in VTK, as well as extended applications. I hope it will be helpful to all of you! Thank you all for […]

vtk implements two methods of segmenting images and overlaying display of original images

1. Implemented with vtkImageBlend vtkLookupTable implements the mapping of grayscale images to color images, and vtkImageBlend overlays grayscale images and color images. The specific code is as follows: //Segmented image vtkSmartPointer<vtkLookupTable> pColorTable = vtkSmartPointer<vtkLookupTable>::New(); pColorTable->SetNumberOfColors(2); pColorTable->SetTableRange(0, 255); pColorTable->SetTableValue(0, 0.0, 0.0, 0.0, 0.0); pColorTable->SetTableValue(1, 0, 1, 0, 1.0); pColorTable->Build(); vtkSmartPointer<vtkImageMapToColors> colorMap = vtkSmartPointer<vtkImageMapToColors>::New(); colorMap->SetInputData(outImage); colorMap->SetLookupTable(pColorTable); colorMap->Update(); […]