[vtkusers] Change slicing plane when using vtkImageResliceMapper

ochampao ochampao at hotmail.com
Mon Mar 12 07:56:36 EDT 2018


Hello vtkUsers,

I am using a pipeline with vtkImageResliceMapper --> vtkImageSlice -->
vtkImageStack for displayng a slice of a volume imported from a dicom
series. This works well with the default slicing plane (0,0,1), however,
when I try changing the slicing plane using
vtkImageResliceMapper::GetSlicePlane()->SetNormal() the plane does not
change. When I print the SlicePlane normal, I can see that the new normal is
registered. Also, using UpdateInformation() or Modified() did not have any
effect.

My undersanding is that the SlicePlane is what determines the plane that the
camera will follow when SliceFacesCameraOn() and SliceAtFocalPointOn() are
used.

What is the correct approach for changing the slicing plane of
vtkImageResliceMapper?

Below is the code that I am currently using.

Thanks for your help.
Panos.

============================
vtkNew<vtkDICOMImageReader> dicomReader;
dicomReader->SetDirectoryName("path/to/dicom/series");
dicomReader->Update();

vtkNew<vtkImageResliceMapper> dicomMapper;
dicomMapper->SetInputData(dicomReader->GetOutput());
dicomMapper->GetSlicePlane()->SetNormal(0.0, 1.0, 0.0);
dicomMapper->SliceFacesCameraOn();
dicomMapper->SliceAtFocalPointOn();

vtkNew<vtkImageSlice> dicomSlice;
dicomSlice->SetMapper(dicomMapper);
dicomSlice->GetProperty()->UseLookupTableScalarRangeOn();

vtkNew<vtkImageStack> imageStack;
imageStack->AddImage(dicomSlice);

vtkNew<vtkRenderer> renderer;
renderer->AddViewProp(imageStack);
renderer->GetActiveCamera()->ParallelProjectionOn();
renderer->ResetCamera();
renderer->ResetCameraClippingRange();

vtkNew<vtkRenderWindow> renderWindow;
renderWindow->AddRenderer(renderer);

vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;
vtkNew<vtkInteractorStyleImage> style;
style->SetInteractionModeToImageSlicing();

renderWindowInteractor->SetInteractorStyle(style);
renderWindowInteractor->SetRenderWindow(renderWindow);
renderWindowInteractor->Initialize();
renderWindowInteractor->Start();
=============================



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html


More information about the vtkusers mailing list