there are some differences between
mitk::RenderingManager::GetInstance()->InitializeViews(myGeo);
and
mitk::RenderingManager::GetInstance()->InitializeView(myVtkRendererWindow, myGeo);
Try both variants after loading an image, e.g.
poStorage = oSceneIO->LoadScene("example.mitk", poStorage , false);
mitk::NodePredicateNot::Pointer oPred = mitk::NodePredicateNot::New(mitk::NodePredicateProperty::New("includeInBoundingBox", mitk::BoolProperty::New(false)));
mitk::DataStorage::SetOfObjects::ConstPointer oRS = poStorage->GetSubset(oPred); mitk::TimeSlicedGeometry::Pointer oBounds = poStorage->ComputeBoundingGeometry3D(oRS); mitk::Geometry3D::ConstPointer oGeometry = oBounds; if (oGeometry.IsNotNull() ) {
mitk::RenderingManager::GetInstance()->InitializeViews(oGeometry);
// and then try
mitk::RenderingManager::GetInstance()->InitializeView(myStdMultiWidget->GetRenderWindow1()->GetVtkRenderWindow(), oGeometry);
mitk::RenderingManager::GetInstance()->InitializeView(myStdMultiWidget->GetRenderWindow2()->GetVtkRenderWindow(), oGeometry);
mitk::RenderingManager::GetInstance()->InitializeView(myStdMultiWidget->GetRenderWindow3()->GetVtkRenderWindow(), oGeometry);
mitk::RenderingManager::GetInstance()->InitializeView(myStdMultiWidget->GetRenderWindow4()->GetVtkRenderWindow(), oGeometry);
}
The second version does not work, the widget does not get initialized!
SOLUTION:
This must be added to the InitializeView function so that the behaviour is equal, i tested it it works perfect:
Add in line 595 between "}" and "mitk::BaseRenderer* baseRenderer ="
if (geometry.IsNotNull() )
{// make sure bounding box has an extent bigger than zero in any direction // clone the input geometry Geometry3D::Pointer modifiedGeometry = dynamic_cast<Geometry3D*>( dataGeometry->Clone().GetPointer() ); assert(modifiedGeometry.IsNotNull()); Geometry3D::BoundsArrayType newBounds = modifiedGeometry->GetBounds(); for( unsigned int dimension = 0; ( 2 * dimension ) < newBounds.Size() ; dimension++ ) { //check for equality but for an epsilon if( Equal( newBounds[ 2 * dimension ], newBounds[ 2 * dimension + 1 ] ) ) { newBounds[ 2 * dimension + 1 ] += 1; } } // set the newly calculated bounds array modifiedGeometry->SetBounds(newBounds); geometry = modifiedGeometry; }
and add at after "mitk::BaseRenderer::GetInstance( renderWindow );":
baseRenderer->GetDisplayGeometry()->SetConstrainZoomingAndPanning(m_ConstrainedPaddingZooming);