we managed a work around.

but maybe this will be usefull in the future! Thanks Sasha for your reply!

Best,
Miguel


Em 13-11-2013 17:39, Sascha Zelzer escreveu:
Hi,

this looks okay to me. Did you try a "global reinit" in the mitkWorkbench application after your datanode was added? (right-click in the DataManager).

Best,
Sascha

On 11/05/2013 06:44 PM, Miguel Nunes wrote:
Hello,

I am creating a vtkImageData by hand and I cannot successfully transform it into a mitk::image, so I can later add it to the data storage.

Right now I have this and the node is added, but nothing is displayed:

Snippet
mitk::Geometry3D::Pointer geom3d = mitk::Geometry3D::New();
vec[0] = MyVTKImage->GetSpacing()[0];
   vec[1] = MyVTKImage->GetSpacing()[1];
   vec[2] = MyVTKImage->GetSpacing()[2];
geom3d->SetSpacing(vec);
   geom3d->SetFloatBounds(MyVTKImage->GetBounds());
   geom3d->SetImageGeometry(true);
geom3d->SetExtentInMM(0, vec[0]*MyVTKImage->GetExtent()[1]);
   geom3d->SetExtentInMM(1, vec[1]*MyVTKImage->GetExtent()[3]);
   geom3d->SetExtentInMM(2, vec[2]*MyVTKImage->GetExtent()[5]);
mitk::Image::Pointer outputImage = mitk::Image::New();
   outputImage->SetGeometry(geom3d);
   outputImage->Initialize(MyVTKImage);
   outputImage->SetVolume(MyVTKImage->GetScalarPointer());
   outputImage->Update();
Snippet
   mitk::DataNode::Pointer dataNode = mitk::DataNode::New();
   std::string name ="MyVTKImage";
dataNode->SetData(outputImage);
   dataNode->SetProperty("name", mitk::StringProperty::New(name) );
(...)
Snippet
this->GetDataStorage()->Add(dataNode, nodes.front());


So, does anyone know what I am doing wrong or if there's a better way to achieve this?
Thank you




------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to