Hi Simon,
the easiest way to add your vtk mesh to the DataStorage is to use the
mitk::Surface representation.
After creating your vtkPolyData, write the following:
mitk::Surface::Pointer sphereSurface = mitk::Surface::New();
sphereSurface->SetVtkPolyData(sphereData);
...
sphereNode->SetData(sphereSurface);
sphereNode->SetName("some name");
DataStorage->Add(sphereNode)
...
Hope this helps.
Regards,
Alex
-----Ursprüngliche Nachricht-----
Von: Simon Eck [mailto:[email protected]]
Gesendet: Dienstag, 27. April 2010 10:50
An: [email protected]
Betreff: [mitk-users] Add VTK Mesh Objects to DataStorage
Dear all,
I try to add VTK mesh objects to a DataStorage in MITK 0.14 and found
the method
mitk::DataTreeNode::Pointer CommonFunctionality::AddVtkMeshToDataTree(
vtkPolyData *polys, mitk::DataTreeIteratorBase *iterator, std::string str)
for that reason. However I can't figure out how to get an iterator for
my Node out of the DataStorage instance. Right now i'm not sure about
using iterators for this kind of tasks at all in MITK 0.14, as i also
read about the change from DataTree to DataStorage (without iterator
interface) some days ago.
May you explain the proper way of adding VTK objects to a DataStorage?
My experimental code so far:
#include "QmitkCommonFunctionality.h"
#include "vtkSphereSource.h"
...
void Experimental::createVtkObjects() {
vtkSphereSource* sphere = vtkSphereSource::New();
sphere->SetRadius(50);
sphere->SetCenter(0.0, 0.0, 0.0);
sphere->SetThetaResolution(24);
sphere->SetPhiResolution(24);
vtkPolyData* sphereData = sphere->GetOutput();
mitk::DataTreeNode::Pointer sphereNode = mitk::DataTreeNode::New();
sphereNode->SetVisibility(true);
//???
// mitk::DataTreeNode* node =
CommonFunctionality::AddVtkMeshToDataTree(sphereData, , "My Sphere");
DataStorage->Add(sphereNode);
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
Thanks in advance,
Simon
--
Simon Eck
Biomedical Computer Vision Group
Im Neuenheimer Feld 267
69120 Heidelberg
[email protected]
------------------------------------------------------------------------------
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users
------------------------------------------------------------------------------
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users