[vtkusers] Setting interactor views (coronal, sagital, axial)

Sergio Vera sergio.vera at alma3d.com
Wed Dec 5 10:15:28 EST 2012


Hi David,
It's not working :(

here is the snippet of my code:


void
SliceRenderView::SetView(
ViewType a_view)
{
d_view = a_view;
 switch (d_view) {
case eAxial: {
d_interactorStyle->SetZViewRightVector(1,0,0);
d_interactorStyle->SetZViewUpVector(0,1,0);
}
break;
case eSagittal: {
d_interactorStyle->SetXViewRightVector(0,1,0);
d_interactorStyle->SetXViewUpVector(0,0,1);
}
break;
case eCoronal: {
d_interactorStyle->SetYViewRightVector(1,0,0);
d_interactorStyle->SetYViewUpVector(0,0,1);
}
break;
case eOblique:
 default:
std::cout << "Unimplemented" << std::endl;
}
this->setCornerAnnotationText(d_ViewText[d_view]);
this->renderer()->ResetCamera();
d_interactorStyle->SetImageOrientation(d_interactorStyle->GetZViewRightVector(),
d_interactorStyle->GetZViewUpVector());
/*
this->renderWindow()->Render();
this->renderWindow()->GetInteractor()->Render();
this->repaint();
*/
}

It gets called when the image has been loaded

void
SliceRenderView::setImageData(
VolumeData* a_data)
{
std::cout << __FUNCTION__ << std::endl;

d_image = a_data->GetImage();
d_imgResliceMapper->SetInput(d_image);
d_imgSlice->SetMapper(d_imgResliceMapper);
d_imgSlice->SetProperty(d_imgProp);
this->SetView(d_view);
this->renderWindow()->Render();
this->renderer()->ResetCameraClippingRange();
}

Any hints on what can be wrong?


On Wed, Dec 5, 2012 at 1:16 PM, David Gobbi <david.gobbi at gmail.com> wrote:

> Hi Sergio,
>
> The view will change if you call SetImageOrientation().  For example:
>
> style->SetImageOrientation(style->GetZViewRightVector(),
>                           style->GetZViewUpVector());
>
> Or you can use code like this:
>
> double vector1[3] = { 1.0, 0.0, 0.0 };
> double vector2[3] = { 0.0, 0.0, -1.0 };
> style->SetImageOrientation(vector1, vector2);
>
>  - David
>
> On Wed, Dec 5, 2012 at 2:53 AM, Sergio Vera <sergio.vera at alma3d.com>
> wrote:
> > Hello all
> > I'm implementing a medical image viewer with the typical 3+1 windows
> (axial,
> > coronal sagittal and 3d) layout.
> >
> > Each window has his vtkRenderWindowInteractor and vtkIntractorStyleImage
> >
> > I setup the interactor styles views vectors (right & up) for each slice
> view
> > (axial, coronal, sagital) with
> > SetZViewRightVector() and SetZViewUpVector().
> >
> > However, my views don't change, no matter how hard I try to update the
> > window / renderer / renderwindow /camera (I believe I've tested almost
> all,
> > if not all possibilities)
> >
> > The only way is to manually click "x" "z" or "y" keys on each window to
> > obtain the desired point of view in the images.
> >
> > Anyone knows how to automatically set my views to the desired way without
> > having to press keys?
> >
> > By the wai I use ctkVTKRenderView not a regular vtkRenderWindow but I
> > believe this is not related to CTK.
> >
> > Best regards
> > --
> > Sergio Vera
> >
> >  Alma IT Systems
> >  C/ Vilana, 4B, 4º 1ª
> >  08022 Barcelona
> >  T. (+34) 932 380 592
> >  www.alma3d.com
>



-- 
Sergio Vera

 Alma IT Systems
 C/ Vilana, 4B, 4º 1ª
 08022 Barcelona
 T. (+34) 932 380 592
 www.alma3d.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121205/0341fe68/attachment.htm>


More information about the vtkusers mailing list