Currently i can think of 3 ways to rotate the renderwindows to a specific constellation (see below). They all behave different, have bugs and/or are not really working as they should.
We need a CENTRAL place for rotations of the renderwindows.
We need a WELL DEFINED behavior.
We need TESTS for it.
Here the 3 ways i can think of (and that are used in MITK)
Get your renderwindows:
m_RendererTra = mitk::BaseRenderer::GetInstance( mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget1") ); m_RendererSag = mitk::BaseRenderer::GetInstance( mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget2") ); m_RendererCor = mitk::BaseRenderer::GetInstance( mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget3") ); m_Renderer3D = mitk::BaseRenderer::GetInstance( mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget4") );
Possibilitiy 1)
m_RendererTra->GetSliceNavigationController()->ReorientSlices( center, vec );
Maybe Display Geometry is not updated?? Well, renderwindow-planes are kinda rotated, but the display is not oriented to the plane. The look of the result is depending on the previous orientation of your renderwindow:
In the attachement you find two screenshots, where I reoriented the planes with the same lines of code. But one time I rotated the planes manually a little before starting the orientation code.
Possibility 2)
mitk::Vector3D vecUp;
vecUp[0] = 0;
vecUp[1] = 1;
vecUp[2] = 0;
mitk::Point3D center = this->GetRenderWindowPart()->GetSelectedPosition();
mitk::RotationOperation op(mitk::OpROTATE, center, vecUp, 180);
const mitk::Geometry3D *geometry3D = m_RendererTra->GetSliceNavigationController()->GetCurrentGeometry3D();
const_cast< mitk::Geometry3D * >( geometry3D )->ExecuteOperation( &op ); m_RendererTra->GetSliceNavigationController()->SendCreatedWorldGeometryUpdate();
This seems quite dirty due to the const-casts. Also I just rotate the planes here, but i cannot apply a specific orientation defined by axisvectors or matrix. But in contrary to possibilty 1 the renderwindow displays seem to be fit to the planes.
Possibilty 3)
mitk::ILinkedRenderWindowPart* linkedRenderWindow =
dynamic_cast<mitk::ILinkedRenderWindowPart*>(this->GetRenderWindowPart());
mitk::Point3D p;
p[0] = 1;
p[1] = 2;
p[2] = 1;
linkedRenderWindow->GetSlicesRotator()->RotateToPoint(
m_RendererTra->GetSliceNavigationController(), m_RendererSag->GetSliceNavigationController(), p, false);
The name implies that some of the input slice will be rotate to include some point. but that is not really happening. Some rotation takes place, but i cannot really figure out how. Code is extremly ugly. No comment or documentation. But propably this would be the "best" solution, since it is done by using the linkedRenderWindow, a quite central unit.