使用vtkImagePlaneWidget和vtkPOpenFOAMReader的问题

时间:2019-02-12 03:02:19

标签: qt vtk

enter image description here Image is here

我使用vtkPOpenFOAMReader读取* .foam。 而且我还使用vtkImagePlaneWidget读取dicom数据以进行3D显示。 一切都很好,我得到了结果。但是有一个关键问题。

我可以看到泡沫数据是完美的。 但是,如果仅添加此代码<(1)>,则泡沫数据上会出现一条虚线。

#include "mainwindow.h"
#include <QApplication>
#include <iostream>
using namespace std;
#include <vtkAutoInit.h> 
VTK_MODULE_INIT(vtkRenderingOpenGL2);
VTK_MODULE_INIT(vtkInteractionStyle);
VTK_MODULE_INIT(vtkRenderingFreeType);
int main(int argc, char *argv[])
{
vtkSmartPointer<vtkImagePlaneWidget> planeWidget = vtkSmartPointer<vtkImagePlaneWidget>::New();/*(1)*/
vtkSmartPointer<vtkPOpenFOAMReader>openFOAMReader = vtkSmartPointer<vtkPOpenFOAMReader>::New();

openFOAMReader->SetCaseType(0);
openFOAMReader->SetFileName("./PatientA/ffr.foam");
openFOAMReader->CreateCellToPointOn();
openFOAMReader->EnableAllCellArrays();
openFOAMReader->DecomposePolyhedraOn();
openFOAMReader->Update();

vtkSmartPointer< vtkGeometryFilter> filter = vtkSmartPointer<vtkGeometryFilter>::New();
filter->SetInputConnection(openFOAMReader->GetOutputPort());

vtkSmartPointer<vtkCompositePolyDataMapper2> mapper = vtkSmartPointer<vtkCompositePolyDataMapper2>::New();
mapper->SetInputConnection(filter->GetOutputPort());
mapper->SetScalarModeToUsePointFieldData();
mapper->SelectColorArray("p");
mapper->SetScalarRange(-10, 50);

vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);

vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();
renderer->AddActor(actor);

vtkSmartPointer<vtkRenderWindow> renWin = vtkSmartPointer<vtkRenderWindow>::New();
renWin->AddRenderer(renderer);

vtkSmartPointer<vtkRenderWindowInteractor> iren = vtkSmartPointer<vtkRenderWindowInteractor>::New();
iren->SetRenderWindow(renWin);
renWin->Render();
iren->Start();
return true;
}

那为什么会发生呢?对我来说这是一个非常关键的问题。

0 个答案:

没有答案