[vtkusers] Change slicing plane when using vtkImageResliceMapper
David Gobbi
david.gobbi at gmail.com
Tue Mar 13 13:54:43 EDT 2018
Hi Panos,
I just remembered that vtkInteractorStyleImage provides a convenience
method for positioning the camera called SetImageOrientation(). Unlike
"Azimuth()" it specifies an absolution orientation, rather than a relative
orientation:
// set the camera view via row and column directions,
// these directions must be at right angles to each other
double vLeftToRight[3] = { 0.0, 1.0, 0.0 };
double vBottomToTop[3] = { 0.0, 0.0, 1.0 };
style->SetCurrentRenderer(renderer);
style->SetImageOrientation(vLeftToRight, vBottomToTop);
As for the "sliding image" problem that you saw, I just checked on my own
system and I see exactly the same issue. It seems to be related to the
OpenGL2 backend, I'll have to dig into the mapper code to see what's up.
The odd thing is, I use vtkImageResliceMapper all the time and I have not
seen this problem before. However, I almost never use it with
vtkInteractorStyleImage.
If you don't need oblique views, you can try switching to
vtkImageSliceMapper as a temporary solution. Note that you'll have to
remove the SetNormal() call from your code.
- David
On Tue, Mar 13, 2018 at 8:47 AM, ochampao <ochampao at hotmail.com> wrote:
> Hi David,
>
> Thanks for your reply. Changing the position of the camera works, as you
> suggested.
>
> What I have noticed now is that when I reach the first or final slice
> (min/max clipping planes) and if I keep trying to change the slice by
> pressing Ctrl+Left-Mouse-Button, the image moves to the right (min clipping
> plane) or the left (max clipping plane) instead of remaining in the centre
> of the view. This does not happen with the original slicing plane (before
> moving the camera). Here is a slide to describe the effect:
> https://pasteboard.co/HbIKTZT.png
>
> Do you know why this happens and how to stop it?
>
> This is the code I am using to setup and move the camera:
>
> renderer->GetActiveCamera()->Azimuth(90);
> renderer->GetActiveCamera()->OrthogonalizeViewUp();
> renderer->GetActiveCamera()->ParallelProjectionOn();
> renderer->ResetCameraClippingRange();
> renderer->ResetCamera();
>
> Thanks,
> Panos
>
>
>
>
> --
> Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> https://vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180313/a4fd6bd6/attachment.html>
More information about the vtkusers
mailing list