Hello,

I am trying to display a logo in the 3D render window of a
qmitkStdMultiWidget, similarly to what is done in the MitkWorkbench with
the "MITK|dkfz" logo. I found in QmitkMultiWidgetDecorationManager that I
should the use mitkLogoAnnotation class. However, I haven't been able to
display the logo on the render window.

Here is the code:

mitk::LogoAnnotation::Pointer logoAnnotation = mitk::LogoAnnotation::New();
logoAnnotation->SetOpacity(1);
mitk::Point2D offset;
offset.Fill(0.03);
logoAnnotation->SetOffsetVector(offset);
logoAnnotation->SetRelativeSize(0.25);
logoAnnotation->SetCornerPosition(1);
logoAnnotation->SetVisibility(true);

QImage *qimage = new QImage(qPrintable(":/src/MyLogo.png"));
vtkSmartPointer<vtkQImageToImageSource> qImageToVtk;
qImageToVtk = vtkSmartPointer<vtkQImageToImageSource>::New();
qImageToVtk->SetQImage(qimage);
qImageToVtk->Update();
vtkSmartPointer<vtkImageData> vtkLogo = qImageToVtk->GetOutput();

std::shared_ptr<QmitkRenderWindowWidget> renderWindowWidget = ui->
QstdMultiWidget->GetLastRenderWindowWidget();
if (nullptr != renderWindowWidget && logoAnnotation.IsNotNull())
{
mitk::ManualPlacementAnnotationRenderer::AddAnnotation(logoAnnotation.
GetPointer(), renderWindowWidget->GetRenderWindow()->GetRenderer());
logoAnnotation->SetLogoImage(vtkLogo);
mitk::BaseRenderer *renderer = mitk::BaseRenderer::GetInstance(
renderWindowWidget->GetRenderWindow()->GetVtkRenderWindow());
logoAnnotation->Update(renderer);
renderWindowWidget->RequestUpdate();
}

The image is loaded successfully (I checked it by making a mitkImage from
vtkLogo and adding it to the data storage), and both the renderWindowWidget
and the logoAnnotation are not null/nullptr since the code inside the if
condition is executed.

Any idea on how I can solve this? I have tried with different offsets,
relative sizes and corner positions. I also tried to call AddToBaseRenderer
and AddToRenderer. It seems to me that the logoAnnotation is not added to
the renderer.

Thank you,

Enric
_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to