vtkBorderWidget: Implement a box that follows the mouse movement

#include <vtkActor.h> #include <vtkBorderRepresentation.h> #include <vtkBorderWidget.h> #include <vtkCommand.h> #include <vtkNamedColors.h> #include <vtkNew.h> #include <vtkObjectFactory.h> #include <vtkPolyData.h> #include <vtkPolyDataMapper.h> #include <vtkProperty.h> #include <vtkRenderWindow.h> #include <vtkRenderWindowInteractor.h> #include <vtkRenderer.h> #include <vtkSphereSource.h> #include <vtkWidgetCallbackMapper.h> #include <vtkWidgetEvent.h> class vtkCustomBorderWidget : public vtkBorderWidget { public: static vtkCustomBorderWidget* New(); vtkTypeMacro(vtkCustomBorderWidget, vtkBorderWidget); static void MoveAction(vtkAbstractWidget* w); static void EndSelectAction(vtkAbstractWidget* w); vtkCustomBorderWidget(); }; class […]

Qt +VTK+Cmake compilation and environment configuration (Part 1: Mining Pit)

VTK download address: https://vtk.org/download/ cmake download address: https://cmake.org/download/ In terms of version correspondence, if your project has no version requirements, don’t worry about it. I built it randomly by myself. Please choose the latest version of VTK. If other libraries later do not support higher versions, I will use lower versions. Here we just introduce […]

VTK vtkOBBTree directed bounding box

vtkOBBTree directed bounding box vtkOBBTree is a tree of bounding boxes, which divides each cell of the body into each small bounding box. SetNumberOfBuckets determines how many Cells are placed in each box. To create a vtkOBBTree, you must first set DataSet and SetDataSet. Then call BuildLocator. The fineness of the bounding box is determined […]

VTK judges whether a point is inside a model stl whether the vtk point is inside the surface or not finds the nearest point

To judge a point, judge whether it is inside the style stl model, or on the surface: Directory 1. Option 1: Use vtkCellLocator FindClosestPoint to find the point on the model that is closest to the given point, and calculate the distance between the two points. If it is less than a certain threshold, the […]

Point cloud library PCL environment configuration: QT 5.9.2+ msvc2017 + PCL1.8.1 + VTK8.0

1. Background: Since the project needs to filter, calculate, display and other operations on the sensor data, the existing lines that make up the surface are sequentially processed by the recursive median average filtering algorithm, the surface shape is not smooth enough, and the effect is relatively poor. Therefore, after consulting the data, I decided […]

[VTK] Based on the read STL model, when the user clicks the left mouse button, the program will get the point of the clicked position, display its coordinates, and set it as the rotation origin of the model

Knowledge is not alone, it must be systematic. For more of my personal summary and related experience, please refer to this column: Visual Studio. Article directory `class PointPickedSignal : public QObject` `class MouseInteractorCommand : public vtkCommand` `void A::on_pushButtonSelected_clicked()` `void A::onPointPicked(double* pos)` `A.h` `A.cpp` Ref. Based on the read STL model, when the user clicks the […]

Win11+Visual Studio C++ 2019+VTK configuration

1. Download VTK source code https://www.vtk.org/files/release/8.2/VTK-8.2.0.zip 2. Download CMAKE https://github.com/Kitware/CMake/releases/download/v3.25.0-rc1/cmake-3.25.0-rc1-windows-x86_64.zip 3. Compile VTK 3.1 Unzip VTK, and create bin and install folders at the same level 3.2 CMAKE configuration After clicking Finish above, click Configure and wait After Configure is complete, find the CMAKE_INSTALL_PREFIX option and change its value to the path of the install […]

VTK seed widget SeedWidget

Part1 Introduction to vtkSeedWidget vtkSeedWidget is used to place multiple seed points in the scene. Seed points can be used for things such as connectivity, region growing segmentation algorithms, segmentation, etc. Renderings: vtkSeedWidget default interactive operation: 1. Click the blank position on the widget to place the seed point 2. Move the mouse into the […]

[Visual Studio] Build VTK with Visual Studio on Windows

Knowledge is not alone, it must be systematic. For more of my personal summary and related experience, please refer to this column: Visual Studio. number content 1 【Visual Studio】Build VTK with Visual Studio on Windows 2 【 Visual Studio] Use Visual Studio on Windows to build VTK with Qt 3 【VTK】VTK display ball example, Use […]

vtk multi-volume fusion

Add the volume to the renderer respectively, and the rendering effect is as follows As you can see, there is no layering in the rendering. #include “vtkAxesActor.h” #include “vtkCamera.h” #include “vtkColorTransferFunction.h” #include “vtkCommand.h” #include “vtkConeSource.h” #include “vtkGPUVolumeRayCastMapper.h” #include “vtkImageResample.h” #include “vtkImageResize.h” #include “vtkInteractorStyleTrackballCamera.h” #include “vtkMultiVolume.h” #include “vtkNew.h” #include “vtkPiecewiseFunction.h” #include “vtkRegressionTestImage.h” #include “vtkRenderWindow.h” #include “vtkRenderWindowInteractor.h” […]