Here is the code:
onDisplayColorMprPixel(vtkImageViewer2* imageViewer, vtkImagePlaneWidget* imagePlane,int slicerIndex)
{
vtkSmartPointer<vtkImageViewer2> viewerLayer = vtkSmartPointer<vtkImageViewer2>::New();
//viewerLayer->SetRenderWindow(imageViewer->GetRenderWindow());//After adding this sentence, there will be no superposition effect
viewerLayer->SetInputData(m_pHessianImageData);
if (m_nIndex == 1)
viewerLayer->SetSliceOrientationToXY();
else if (m_nIndex == 2)
viewerLayer->SetSliceOrientationToYZ();
else if (m_nIndex == 3)
viewerLayer->SetSliceOrientationToXZ();
viewerLayer->GetRenderWindow()->SetShowWindow(false);
viewerLayer->SetSlice(slicerIndex);//到此出为止会出现弹窗
viewerLayer->GetImageActor()->SetInterpolate(false);
viewerLayer->GetImageActor()->GetProperty()->SetLookupTable(pColorTable);
viewerLayer->GetImageActor()->SetOpacity(0.5);
viewerLayer->GetImageActor()->GetProperty()->SetDiffuse(0.0);
viewerLayer->GetImageActor()->SetPickable(false);
vtkImageActor* actor = viewerLayer->GetImageActor();
vtkRenderer* renderer = imageViewer->GetRenderer();
renderer->AddActor(actor);
renderer->AddActor(imageViewer->GetImageActor());
vtkRenderWindow* rw = imageViewer->GetRenderWindow();
rw->AddRenderer(renderer);
rw->Render();
}
'''''''''''''
ImageViewer is the view that originally displays slices,
and viewerlayer is the view overlaying on the original section.
Slicerindex is the section number, and pcolortable is the color table.
Effect:
Problem: a new window will always be created and flashed.
If you release the comments above, a new window will not appear,
but there is no overlaying effect. Only the red label is displayed.
I don't know what suggestions you have.
After reading some things on the Internet, it's still different.
I keep scrolling and displaying each slice.
And display the superposition effect. Red and white.
How to resloved this problem?