Page MenuHomePhabricator

InitializeView of renderingmanager does not behave like InitializeViews
Closed, WontfixPublic

Description

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);

Event Timeline

This bug has a high severity and was not fixed within the 2013-06 release. Setting target milestone to next release.

Current release is finished. Reseting target milestone...

Should be investigated for the upcoming release and verified whether the bug still exists.

kislinsk claimed this task.
kislinsk added a project: Auto-closed.
kislinsk added a subscriber: kislinsk.

Hi there! 🙂

This task was auto-closed according to our Task Lifecycle Management.
Please follow this link for more information and don't forget that you are encouraged to reasonable re-open tasks to revive them. 🚑

Best wishes,
The MITK devs

kislinsk removed kislinsk as the assignee of this task.May 26 2020, 12:05 PM
kislinsk removed a subscriber: kislinsk.