VTK actor disappears

In vtkOpenGLRenderer, there are already more than three plane images (vtkImageSlice). Among them, rotation, scaling, and translation can all be displayed correctly. However, after I added some vtkActors, the images could not be displayed in the 3D window when the angle was modified; the images could only be displayed correctly at the LPI angle.




void QImage3DWnd::InitWindow(QImage2DWnd* pView2D[3], QMultiPlaneProcess* pMultiPlanePro)
{
m_viewAxial = pView2D[0];
m_viewCoronal = pView2D[1];
m_viewSagittal = pView2D[2];
m_pMultiPlanePro = pMultiPlanePro;

m_Camera3D = vtkSmartPointer<vtkCamera>::New();
m_Render3D = vtkSmartPointer<vtkOpenGLRenderer>::New();
m_RendWindow3D = vtkSmartPointer<vtkGenericOpenGLRenderWindow>::New();
m_cubeAxes3D = vtkSmartPointer<vtkOrientationMarkerWidget>::New();
m_style3D = vtkSmartPointer<mivInteractorStyleImage3D> ::New();
//m_renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();

m_RendWindow3D->OpenGLInit();
m_Render3D->SetActiveCamera(m_Camera3D);
m_RendWindow3D->AddRenderer(m_Render3D);
m_viewWidgetVTK->setRenderWindow(m_RendWindow3D);
m_RendWindow3D->SetFrameBlitModeToBlitToHardware();


m_style3D->m_p3DImagWnd = this;
m_style3D->m_pMuiltPlanePro = m_pMultiPlanePro;
m_RendWindow3D->GetInteractor()->SetInteractorStyle(m_style3D);


m_Render3D->SetUseDepthPeeling(true);
m_Render3D->SetMaximumNumberOfPeels(100); 
m_Render3D->SetOcclusionRatio(0.0); 
//m_renderWindowInteractor->SetInteractorStyle(m_style3D);

//
// m_vPointPickerImg = vtkSmartPointer::New();
// m_renderWindowInteractor->SetPicker(m_vPointPickerImg);

InitCubeAxes();
SetBackgroundGradient(0xFFFFFF, 0x1E90FF);


m_Camera3D->SetFocalPoint(0, 0, 0);
m_Camera3D->SetPosition(1000, 0, 0);
m_Camera3D->SetViewUp(0,0, 1);
//m_Camera3D->ComputeViewPlaneNormal();

}

void QImage3DWnd::UpMeasureActorToWindow()
{
std::vector<vtkSmartPointer > vctActor;
m_pMeasurePro->GetPlaneAllMeasureActor(WindowType_3D, vctActor);
if (vctActor.size() <= 0)
return;
std::vector<vtkSmartPointer>::iterator it = vctActor.begin();
while (it != vctActor.end())
{
vtkSmartPointer actor = *it;
if (!FindActorInRender(m_Render3D, actor))
{
m_Render3D->AddViewProp(actor);

	}
		
	it++;
}
m_Render3D->ResetCameraClippingRange();
m_Render3D->ResetCameraScreenSpace();
m_Render3D->ResetCamera();
m_Render3D->Render();

}

I’m just curious, is there a specific reason for reproducing 3D Slicer’s appearance instead of building your application on that platform? The main advantage would be that the feature you described is already implemented and works well, and in case you find any issues then you can report it and others fix it for you for free. This way you can spend your time with implementing features that sets your application apart from others, not waste years with redeveloping all the features that every other medical imaging applications already have.

First of all, thank you for your attention.

The reason for not basing the project on 3D Slicer is that, during the testing of 3D Slicer’s multiplanar functionality, we discovered some bugs. Some of these bugs require an in-depth understanding of underlying algorithm logic and architecture, which would consume a considerable amount of time. For example, issues arose with display after using SlabReslice for rotation and other operations, and then attempting to reset. Due to a lack of sufficient time to deeply understand and learn, or perhaps due to insufficient skill, we chose the simplest approach: simulating some of the visible aspects of 3D Slicer’s architecture to create a new project. :sweat_smile:

Of course, the main purpose of creating a new project is to gain a deeper understanding of medical image processing.

You can report any bug on the Slicer Forum (or if you think it does not require much discussion then directly at https://issues.slicer.org) and we’ll fix it.

It is undeniable that 3D Slicer is a very good open-source project with an excellent overall architecture, and I particularly like its interface design. However, some personalized functional operations may not quite meet my needs, and the time cost for my personal learning and usage is too high.

Thank you for your suggestion. I will record some of the bugs I encounter while using 3D Slicer and submit them later.