Hi David, <div>It's not working :(</div><div><br></div><div>here is the snippet of my code:</div><div><br></div><div><br></div><div><div><font face="courier new, monospace">void </font></div><div><font face="courier new, monospace">SliceRenderView::SetView(</font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>ViewType a_view)</font></div><div><font face="courier new, monospace">{</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>d_view = a_view;</font></div>
<div><span class="" style="white-space:pre"><font face="courier new, monospace">        </font></span></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>switch (d_view) {</font></div><div>
<font face="courier new, monospace"><span class="" style="white-space:pre">                </span>case eAxial: {</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">                        </span>d_interactorStyle->SetZViewRightVector(1,0,0);<span class="" style="white-space:pre">        </span></font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre">                        </span>d_interactorStyle->SetZViewUpVector(0,1,0);<span class="" style="white-space:pre">                        </span></font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">                        </span>}</font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre">                        </span>break;</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>case eSagittal: {</font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre">                        </span>d_interactorStyle->SetXViewRightVector(0,1,0);<span class="" style="white-space:pre">        </span></font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">                        </span>d_interactorStyle->SetXViewUpVector(0,0,1);<span class="" style="white-space:pre">                                                </span></font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre">                        </span>}</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">                        </span>break;</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>case eCoronal: {</font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre">                        </span>d_interactorStyle->SetYViewRightVector(1,0,0);<span class="" style="white-space:pre">        </span></font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">                        </span>d_interactorStyle->SetYViewUpVector(0,0,1);<span class="" style="white-space:pre">                        </span></font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre">                        </span>}</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">                        </span>break;</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>case eOblique:</font></div>
<div><span class="" style="white-space:pre"><font face="courier new, monospace">                        </font></span></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>default:</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">                        </span>std::cout << "Unimplemented" << std::endl;</font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>}<span class="" style="white-space:pre">        </span></font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>this->setCornerAnnotationText(d_ViewText[d_view]);</font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>this->renderer()->ResetCamera();</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>d_interactorStyle->SetImageOrientation(d_interactorStyle->GetZViewRightVector(),</font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>d_interactorStyle->GetZViewUpVector());<span class="" style="white-space:pre">                </span></font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>/*</font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>this->renderWindow()->Render();</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>this->renderWindow()->GetInteractor()->Render();</font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>this->repaint();</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>*/</font></div>
<div><font face="courier new, monospace">}</font></div></div><div><font face="courier new, monospace"><br></font></div><div><font face="arial, helvetica, sans-serif">It gets called when the image has been loaded</font></div>
<div><font face="arial, helvetica, sans-serif"><br></font></div><div><div><font face="courier new, monospace">void </font></div><div><font face="courier new, monospace">SliceRenderView::setImageData(</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>VolumeData* a_data)</font></div>
<div><font face="courier new, monospace">{</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>std::cout << __FUNCTION__ << std::endl;</font></div><div><font face="courier new, monospace"><br>
</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>d_image = a_data->GetImage();</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>d_imgResliceMapper->SetInput(d_image);<span class="" style="white-space:pre">        </span></font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>d_imgSlice->SetMapper(d_imgResliceMapper);<span class="" style="white-space:pre">        </span></font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>d_imgSlice->SetProperty(d_imgProp); </font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>this->SetView(d_view);</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>this->renderWindow()->Render();<span class="" style="white-space:pre">                </span></font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>this->renderer()->ResetCameraClippingRange();<span class="" style="white-space:pre">                </span> <span class="" style="white-space:pre">        </span></font></div>
<div><span class="" style="white-space:pre"><font face="courier new, monospace">        </font></span></div><div><font face="courier new, monospace">}</font></div><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif">
Any hints on what can be wrong?</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Dec 5, 2012 at 1:16 PM, David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Sergio,<br>
<br>
The view will change if you call SetImageOrientation(). For example:<br>
<br>
style->SetImageOrientation(style->GetZViewRightVector(),<br>
style->GetZViewUpVector());<br>
<br>
Or you can use code like this:<br>
<br>
double vector1[3] = { 1.0, 0.0, 0.0 };<br>
double vector2[3] = { 0.0, 0.0, -1.0 };<br>
style->SetImageOrientation(vector1, vector2);<br>
<br>
- David<br>
<div class="HOEnZb"><div class="h5"><br>
On Wed, Dec 5, 2012 at 2:53 AM, Sergio Vera <<a href="mailto:sergio.vera@alma3d.com">sergio.vera@alma3d.com</a>> wrote:<br>
> Hello all<br>
> I'm implementing a medical image viewer with the typical 3+1 windows (axial,<br>
> coronal sagittal and 3d) layout.<br>
><br>
> Each window has his vtkRenderWindowInteractor and vtkIntractorStyleImage<br>
><br>
> I setup the interactor styles views vectors (right & up) for each slice view<br>
> (axial, coronal, sagital) with<br>
> SetZViewRightVector() and SetZViewUpVector().<br>
><br>
> However, my views don't change, no matter how hard I try to update the<br>
> window / renderer / renderwindow /camera (I believe I've tested almost all,<br>
> if not all possibilities)<br>
><br>
> The only way is to manually click "x" "z" or "y" keys on each window to<br>
> obtain the desired point of view in the images.<br>
><br>
> Anyone knows how to automatically set my views to the desired way without<br>
> having to press keys?<br>
><br>
> By the wai I use ctkVTKRenderView not a regular vtkRenderWindow but I<br>
> believe this is not related to CTK.<br>
><br>
> Best regards<br>
> --<br>
> Sergio Vera<br>
><br>
> Alma IT Systems<br>
> C/ Vilana, 4B, 4º 1ª<br>
> 08022 Barcelona<br>
> T. <a href="tel:%28%2B34%29%20932%20380%20592" value="+34932380592">(+34) 932 380 592</a><br>
> <a href="http://www.alma3d.com" target="_blank">www.alma3d.com</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Sergio Vera<br><br> Alma IT Systems<br> C/ Vilana, 4B, 4º 1ª<br> 08022 Barcelona<br> T. (+34) 932 380 592<br> <a href="http://www.alma3d.com">www.alma3d.com</a><br>
</div>