SetSlice function in vtkResliceImageViewer is not properly working.

I am developing a Qt application using C++ to display the three dicom views and perform interaction between them.
I have displayed DICOM using vtkSmartPointer

resliceImageViewer->SetSlice(100);

should set the dicom slice value to 100. Actually it does in backend, but in UI there is no change. The default slice is set at mid-value and is not changing in UI.

The following is my script

resliceImageViewer[1] = vtkSmartPointer<vtkResliceImageViewer>::New();
resliceImageViewer[1]->GetRenderer()->AddViewProp ( cornerAnnotationCorL);
ui->renderDockWidgetCoronal->SetRenderWindow(resliceImageViewer[1]->GetRenderWindow());
resliceImageViewer[1]->SetupInteractor(ui->renderDockWidgetCoronal->GetRenderWindow()->GetInteractor());

vtkResliceCursorLineRepresentation *rep = vtkResliceCursorLineRepresentation::SafeDownCast(
      resliceImageViewer[1]->GetResliceCursorWidget()->GetRepresentation());
resliceImageViewer[1]->SetResliceCursor(resliceImageViewer[0]->GetResliceCursor());

rep->GetResliceCursorActor()->
  GetCursorAlgorithm()->SetReslicePlaneNormal(1);
resliceImageViewer[1]->SetInputData(reader->GetOutput());
resliceImageViewer[1]->SetSliceOrientation(1);
resliceImageViewer[1]->SetResliceModeToAxisAligned();
resliceImageViewer[1]->SetResliceMode(1);
resliceImageViewer[1]->GetRenderer()->ResetCamera();
resliceImageViewer[1]->Render();

corCam = vtkCamera::New();
corCam->SetPosition(0, 0, 1);
corCam->SetViewUp(0, -1, 0);
corCam = resliceImageViewer[1]->GetRenderer()->GetActiveCamera();
corCam->Roll(180);
resliceImageViewer[1]->SetSliceOrientationToXZ();
resliceImageViewer[1]->GetRenderer()->ResetCamera();
resliceImageViewer[1]->Render();

resliceImageViewer[1]->SetSlice(100); // this is not reflecting in UI
resliceImageViewer[1]->GetRenderer()->ResetCamera();
resliceImageViewer[1]->Render();

I couldn’t find any possible solution to this issue.
Help me out, guys.

I am developing a Qt application using C++ to display the three dicom views and perform interaction between them.

Are you sure you have setup the VTK render window correctly with Qt? Normally one would use QVTKOpenGLNativeWidget. I think you need to assign that to vtkResliceImageViewer’s render window.

Yes, I have used QVTKWidget to render DICOM in UI.

If I use vtkSmartPointer instead of vtkresliceimageviewer, there is no issue.
But I need vtkResliceImageViewer, only then I can interact between all three views using vtkResliceCursorCallback.

If I use vtkSmartPointer instead of vtkresliceimageviewer, there is no issue.

You mean vtkSmartPointer<vtkResliceImageViewer> instead of vtkResliceImageViewer*? If that works, then use the smart pointer because it keeps the reslice image viewer instance alive. In the code you shared, it looks like you’re already using a smart pointer.

yes, i am using vtkSmartPointer<vtkResliceImageViewer> instead of vtkSmartPointer<vtkImageViewer2>