Hi Simon,

Try 
  sphere->Update();
before 
  sphere->Getoutput();

Regards, 
 Jochen

> -----Ursprüngliche Nachricht-----
> Von: Simon Eck [mailto:[email protected]]
> Gesendet: Dienstag, 27. April 2010 16:53
> An: [email protected]
> Betreff: Re: [mitk-users] Add VTK Mesh Objects to DataStorage
> 
> Hi Alex,
> 
> thank you for the fast answer! Using a surface seems to work fine in
> general. When calling my method a new surface is created in the data
> manager. However i there is nothing displayed inside the multiwidget. I
> experimented with some parameters of the vtkSphereSource object, but no
> success.
> 
> 
> This is how it looks right now:
> 
> void Experimental::createVtkObjects() {
>       mitk::DataTreeNode::Pointer node = getSelectedNode();
>       if( node.IsNull() ) {
>               return;
>       }
> 
>       vtkSphereSource* sphere = vtkSphereSource::New();
>       sphere->SetCenter(0.0, 0.0, 0.0);
>       sphere->SetRadius(200);
>       sphere->SetThetaResolution(18);
>       sphere->SetPhiResolution(18);
>       vtkPolyData* sphereData = sphere->GetOutput();
> 
>       mitk::Surface::Pointer sphereSurface = mitk::Surface::New();
>       sphereSurface->SetVtkPolyData(sphereData);
> 
>       mitk::DataTreeNode::Pointer sphereNode =
> mitk::DataTreeNode::New();
>       sphereNode->SetData(sphereSurface);
>       int layer = 0;
>       node->GetIntProperty("layer", layer);
>       sphereNode->SetIntProperty("layer", layer+1);
>       sphereNode->SetProperty("Surface",
> mitk::BoolProperty::New(true));
>       sphereNode->SetName("my VTK Mesh");
>       sphereNode->SetVisibility(true);
> 
>       DataStorage->Add(sphereNode, node);
> 
>       mitk::RenderingManager::GetInstance()->RequestUpdateAll();
> }
> 
> 
> Maybe i am missing something...any ideas are appreciated.
> 
> 
> Regards,
> Simon
> 
> 
> 
> ---------------------------------------
> 
> 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

Reply via email to