Hello,

the problem, that I am facing, concerns the display of an arbitary image 
in space. I already know that there is a similar topic posted in the 
mailing list archive, but it does not lead to a certain working 
solution. The idea, based also on the aforementioned topic, is to create 
a arbitary plane, with the same postition and orientation in space as 
the image, and display the image, as a texture, on top of it.

/*
QmitkFunctionality* m_View
mitk::Image::Pointer ImagePointer
mitk::PlaneGeometry::Pointer ImagePlanePointer
mitk::DataTreeNode::Pointer ImageDataTreeNodePointer
mitk::Geometry2DData::Pointer ImagePlaneDataPointer
mitk::DataTreeNode::Pointer ImagePlaneDataTreeNodePointer
mitk::VtkPropRenderer* m_Renderer
mitk::ImageMapper2D::Pointer mapper2D
mitk::Geometry2DDataVtkMapper3D::Pointer mapper3D
*/

m_Renderer = m_View->m_MultiWidget->GetRenderWindow4()->GetRenderer();  
ImageDataTreeNodePointer->SetData(ImagePointer);
ImageDataTreeNodePointer->SetVisibility(true, m_Renderer);
mapper2D->SetDefaultProperties(ImageDataTreeNodePointer, m_Renderer, true);
mapper2D->GenerateAllData();
ImageDataTreeNodePointer->SetMapper(mitk::BaseRenderer::Standard2D, 
mapper2D); //if removed, the result does not change!
ImageDataTreeNodePointer->Update();
m_View->GetDataStorage()->Add(ImageDataTreeNodePointer);

ImagePlaneDataPointer->SetGeometry(ImagePlanePointer);
ImagePlaneDataPointer->Update();

mapper3D->SetDefaultProperties(ImageDataTreeNodePointer, m_Renderer, true);
//mapper3D->SetDataTreeNode(ImageDataTreeNodePointer); //throws error-
//exception
mapper3D->SetDataStorageForTexture(m_View->GetDataStorage());
//mapper3D->Update(m_Renderer); //throws error-exception


ImagePlaneDataTreeNodePointer->SetData(ImagePlaneDataPointer);
ImagePlaneDataTreeNodePointer->SetMapper(mitk::BaseRenderer::Standard3D, 
mapper3D);
ImagePlaneDataTreeNodePointer->Update();
m_View->GetDataStorage()->Add(ImagePlaneDataTreeNodePointer, 
ImageDataTreeNodePointer);

The result of the code is the display of the plane without any texture 
(image) on it. Both objects are added sucessfully in the data storage as 
parent and child nodes and have correct/identical 
positions/orientations. Simple pointers are based on dynamically created 
objects.

Minor changes have been tested with no better results. It seems, the 
mappers are initialized/used in a wrong way.

I am looking forward for your answer. Thank you in advance for the help.

Best regards,
Efthymios

------------------------------------------------------------------------------

_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to