我是 ITK/VTK 的新手,在学习过程中,在 VTK 中我们如何一次调用多个可视化输出窗口(针对不同输出窗口具有不同功能的拆分屏幕)。我尝试使用多个线程实现上述内容,但我无法实现上述期望..
// output window function 1
std::string inputFilename="E:\\DICOM_work\\CE53E85F";
vtkSmartPointer<vtkDICOMImageReader> reader =vtkSmartPointer<vtkDICOMImageReader>::New();
reader->SetFileName(inputFilename.c_str());
reader->Update();
// Visualize
vtkSmartPointer<vtkImageViewer2> imageViewer = vtkSmartPointer<vtkImageViewer2>::New();
imageViewer->SetInputConnection(reader->GetOutputPort());
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();
imageViewer->SetupInteractor(renderWindowInteractor);
imageViewer->Render();
imageViewer->GetRenderer()->ResetCamera();
imageViewer->Render();
renderWindowInteractor->Start();
}
// output window function 2
void display1(void *)
{
std::string inputFilename="E:\\DICOM_work\\CE53E85Fg2";
vtkSmartPointer<vtkDICOMImageReader> reader1 = vtkSmartPointer<vtkDICOMImageReader>::New();
reader1->SetFileName(inputFilename.c_str());
reader1->Update();
// Visualize
vtkSmartPointer<vtkImageViewer2> imageViewer2 = vtkSmartPointer<vtkImageViewer2>::New();
imageViewer2->SetInputConnection(reader1->GetOutputPort());
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor1 = vtkSmartPointer<vtkRenderWindowInteractor>::New();
imageViewer2->SetupInteractor(renderWindowInteractor1);
imageViewer2->Render();
imageViewer2->GetRenderer()->ResetCamera();
imageViewer2->Render();
renderWindowInteractor1->Start();
}
当我尝试执行它时..代码执行到...
renderWindowInteractor->Start();
然后代码退出而不执行其他函数。请帮忙!