MCPcopy Create free account
hub / github.com/MITK/MITK / ProcessNode

Method ProcessNode

Modules/Core/src/Rendering/mitkPlaneGeometryDataVtkMapper3D.cpp:438–563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

436 }
437
438 void PlaneGeometryDataVtkMapper3D::ProcessNode(DataNode *node,
439 BaseRenderer *renderer,
440 Surface *surface,
441 LayerSortedActorList &layerSortedActors)
442 {
443 if (node != nullptr)
444 {
445 // we need to get the information from the 2D mapper to render the texture on the 3D plane
446 auto *imageMapper =
447 dynamic_cast<ImageVtkMapper2D *>(node->GetMapper(1)); // GetMapper(1) provides the 2D mapper for the data node
448
449 // if there is a 2D mapper, which is not the standard image mapper...
450 if (!imageMapper && node->GetMapper(1))
451 { //... check if it is the composite mapper
452 std::string cname(node->GetMapper(1)->GetNameOfClass());
453 if (!cname.compare("CompositeMapper")) // string.compare returns 0 if the two strings are equal.
454 {
455 // get the standard image mapper.
456 // This is a special case in MITK and does only work for the CompositeMapper.
457 imageMapper = dynamic_cast<ImageVtkMapper2D *>(node->GetMapper(3));
458 }
459 }
460
461 if ((node->IsVisible(renderer)) && imageMapper)
462 {
463 WeakPointerProperty::Pointer rendererProp =
464 dynamic_cast<WeakPointerProperty *>(GetDataNode()->GetPropertyList()->GetProperty("renderer"));
465
466 if (rendererProp.IsNotNull())
467 {
468 BaseRenderer::Pointer planeRenderer =
469 dynamic_cast<BaseRenderer *>(rendererProp->GetWeakPointer().GetPointer());
470 // Retrieve and update image to be mapped
471 const ImageVtkMapper2D::LocalStorage *localStorage = imageMapper->GetConstLocalStorage(planeRenderer);
472
473 if (planeRenderer.IsNotNull())
474 {
475 // perform update of imagemapper if needed (maybe the respective 2D renderwindow is not rendered/update
476 // before)
477 imageMapper->Update(planeRenderer);
478
479 // If it has not been initialized already in a previous pass,
480 // generate an actor and a texture object to
481 // render the image associated with the ImageVtkMapper2D.
482 vtkActor *imageActor;
483 vtkDataSetMapper *dataSetMapper = nullptr;
484 vtkTexture *texture;
485 if (m_ImageActors.count(imageMapper) == 0)
486 {
487 dataSetMapper = vtkDataSetMapper::New();
488
489 texture = vtkNeverTranslucentTexture::New();
490 texture->RepeatOff();
491
492 imageActor = vtkActor::New();
493 imageActor->SetMapper(dataSetMapper);
494 imageActor->SetTexture(texture);
495 imageActor->GetProperty()->SetOpacity(

Callers 1

Calls 15

GetMapperMethod · 0.80
IsNotNullMethod · 0.80
GetPointerMethod · 0.80
GetWeakPointerMethod · 0.80
GetConstLocalStorageMethod · 0.80
countMethod · 0.80
SetMapperMethod · 0.80
SetInputConnectionMethod · 0.80
NewFunction · 0.50
GetNameOfClassMethod · 0.45
IsVisibleMethod · 0.45
GetPropertyMethod · 0.45

Tested by

no test coverage detected