首页 > 其他分享 >VTK 实例60:等值面提取(表面重建)

VTK 实例60:等值面提取(表面重建)

时间:2023-08-16 09:01:43浏览次数:43  
标签:vtkSmartPointer 等值 VTK surface 60 reader renderWindow New include

 1 #include <vtkAutoInit.h>
 2 VTK_MODULE_INIT(vtkRenderingOpenGL2);
 3 VTK_MODULE_INIT(vtkRenderingFreeType);
 4 VTK_MODULE_INIT(vtkInteractionStyle);
 5 
 6 #include <vtkSmartPointer.h>
 7 #include <vtkMarchingCubes.h>
 8 #include <vtkContourFilter.h>
 9 #include <vtkVoxelModeller.h>
10 #include <vtkSphereSource.h>
11 #include <vtkImageData.h>
12 #include <vtkMetaImageReader.h>
13 #include <vtkInteractorStyleImage.h>
14 #include <vtkActor.h>
15 #include <vtkPolyDataMapper.h>
16 #include <vtkRenderWindowInteractor.h>
17 #include <vtkRenderWindow.h>
18 #include <vtkRenderer.h>
19 #include <vtkImageActor.h>
20 #include <vtkProperty.h>
21 
22 //测试:../data/HeadMRVolume.mhd 200
23 int main(int argc, char *argv[])
24 {
25     vtkSmartPointer<vtkMetaImageReader> reader =
26         vtkSmartPointer<vtkMetaImageReader>::New();
27     reader->SetFileName("C:\\Users\\Administrator\\Desktop\\VTK2\\hellovtk\\vtk_图像处理学习\\第六章_图像处理\\data\\HeadMRVolume.mhd");
28     reader->Update();
29 
30     double isoValue = atof("200");//设置等值面值为200
31 
32     vtkSmartPointer<vtkMarchingCubes> surface = 
33         vtkSmartPointer<vtkMarchingCubes>::New();
34     surface->SetInputData(reader->GetOutput());
35     surface->ComputeNormalsOn();
36     surface->SetValue(0, isoValue);
37     //surface->GenerateValues(5, 150,200);
38 
39     /*vtkSmartPointer<vtkContourFilter> surface = 
40     vtkSmartPointer<vtkContourFilter>::New();
41     surface->SetInput(reader->GetOutput());
42     surface->ComputeNormalsOn();
43     surface->SetValue(0, isoValue);*/
44 
45     vtkSmartPointer<vtkPolyDataMapper> surfMapper = 
46         vtkSmartPointer<vtkPolyDataMapper>::New();
47     surfMapper->SetInputConnection(surface->GetOutputPort());
48     surfMapper->ScalarVisibilityOff();
49 
50     vtkSmartPointer<vtkActor> surfActor = 
51         vtkSmartPointer<vtkActor>::New();
52     surfActor->SetMapper(surfMapper);
53     surfActor->GetProperty()->SetColor(1.0, 0.0, 0.0);
54 
55     vtkSmartPointer<vtkRenderer> renderer = 
56         vtkSmartPointer<vtkRenderer>::New();
57     renderer->AddActor(surfActor);
58     renderer->SetBackground(1.0, 1.0, 1.0);
59 
60     vtkSmartPointer<vtkRenderWindow> renderWindow = 
61         vtkSmartPointer<vtkRenderWindow>::New();
62     renderWindow->AddRenderer(renderer);
63     renderWindow->SetSize(640, 480);
64     renderWindow->Render();
65     renderWindow->SetWindowName("PolyDataMarchingCubes");
66     renderWindow->Render();
67 
68     vtkSmartPointer<vtkRenderWindowInteractor> interactor = 
69         vtkSmartPointer<vtkRenderWindowInteractor>::New();
70     interactor->SetRenderWindow(renderWindow);
71 
72     renderWindow->Render();
73     interactor->Start();
74 
75     return EXIT_SUCCESS;
76 }

标签:vtkSmartPointer,等值,VTK,surface,60,reader,renderWindow,New,include
From: https://www.cnblogs.com/ybqjymy/p/17632974.html

相关文章

  • VTK 实例61:点云重建(表面重建)
    1#include<vtkAutoInit.h>2VTK_MODULE_INIT(vtkRenderingOpenGL2);3VTK_MODULE_INIT(vtkRenderingFreeType);4VTK_MODULE_INIT(vtkInteractionStyle);56#include<vtkSmartPointer.h>7#include<vtkPolyDataReader.h>8#inc......
  • VTK 实例62:点云配准
    1#include<vtkAutoInit.h>2VTK_MODULE_INIT(vtkRenderingOpenGL2);3VTK_MODULE_INIT(vtkRenderingFreeType);4VTK_MODULE_INIT(vtkInteractionStyle);56#include<vtkPoints.h>7#include<vtkSmartPointer.h>8#include<......
  • VTK 实例63:纹理映射
    1#include<vtkAutoInit.h>2VTK_MODULE_INIT(vtkRenderingOpenGL2);3VTK_MODULE_INIT(vtkRenderingFreeType);4VTK_MODULE_INIT(vtkInteractionStyle);56#include<vtkSmartPointer.h>7#include<vtkRenderWindowInteractor.h>8#inc......
  • 龙蜥社区安全联盟(OASA)正式成立,启明星辰、绿盟、360 等 23 家厂商重磅加入
    7月28日,由启明星辰、绿盟、360、阿里云、统信软件、浪潮信息、中兴通讯|中兴新支点、Intel、中科院软件所等23家单位共同发起的龙蜥社区安全联盟(OASA,OpenAnolisSecurityAlliance)(以下简称“安全联盟”),于北京举办了线下启动会,共计33位代表出席。会上,首届安全联盟主席龙勤重点解......
  • cf 602 A(进制转换)
    A.TwoBasestimelimitpertestmemorylimitpertestinputoutputX and YX representedinbase bx andanumber Y representedinbase by.Comparethosetwonumbers.Inputn and bx (1 ≤ n ≤......
  • IMXRT 1060 LPI2C总结
    1. However,theLPI2CwillnolongerstalltheI2CbuswaitingforthetransmitorreceiveFIFO,andafterthetransmitFIFOisempty,theLPI2CgeneratesaSTOPconditionautomatically.LPI2C不会因为等待发送/接收FIFO而让I2C总线搁置,并且当发送FIFO为空......
  • VINKA防干扰/抗电压波动的3键/3通道触摸触控芯片VK3603/VK36N3D/VK36N3B 适用于厨房秤
    1.概述VK3603具有3个触摸按键,可用来检测外部触摸按键上人手的触摸动作。该芯片具有较高的集成度,仅需极少的外部组件便可实现触摸按键的检测。提供了3路直接输出功能。芯片内部采用特殊的集成电路,具有高电源电压抑制比,可减少按键检测错误的发生,此特性保证在不利环境条件的应用......
  • AMEYA360:大唐恩智浦荣获〖2023中国具有投资价值车规级芯片企业〗
       2023年8月10日,由无锡市滨湖区政府、市工业和信息化局主办的2023中国汽车半导体新生态论坛暨第五届太湖创芯峰会在无锡隆重举行。峰会介绍当天,滨湖区“集成电路产教融合与人才培养基地”成功揭牌,《2023全球智能汽车产业图谱及研究报告》同期发布。期间,在无锡市......
  • VTK 实例45:理想低通滤波器(频域处理)
    1#include"vtkAutoInit.h"2VTK_MODULE_INIT(vtkRenderingOpenGL2);3VTK_MODULE_INIT(vtkInteractionStyle);45#include<vtkSmartPointer.h>6#include<vtkImageData.h>7#include<vtkImageIdealLowPass.h>8#include&l......
  • VTK 实例46:巴特沃斯低通滤波器(频域处理)
    1#include"vtkAutoInit.h"2VTK_MODULE_INIT(vtkRenderingOpenGL2);3VTK_MODULE_INIT(vtkInteractionStyle);45#include<vtkSmartPointer.h>6#include<vtkImageData.h>7#include<vtkImageButterworthLowPass.h>8#incl......