[vtkusers] problem (empty file) in converting PolyData to StructuredPoints

maroua.mehri maroua.mehri at gmail.com
Mon May 16 05:31:34 EDT 2011


Hello,
I am a new vtk user.
I try to modify type of vtk image.
I would change from PolyData to StructuredPoints but i have an empty file
and I don't understand the problem, is it in writing the new file or
generated because  vtkImageWriter.

  // read PolyData image
  vtkPolyDataReader *vtkreader = vtkPolyDataReader::New();
  vtkreader->SetFileName(entree);

  if (vtkreader->OpenVTKFile()==0) { 
    std::cout<<"Cannot open file: "<&lt;entree&lt;&lt;endl;
    exit(0);
  }
  vtkreader-&gt;Update();

  // declaration objet VtkImageData and read
  vtkImageData *vtkObj = vtkImageData::New();
  vtkObj=(vtkImageData*)vtkreader->GetOutput();
  
  // transformation en vtkImage3D
  vtkImage3D* uneVtkImage3D = vtkImage3D::New();
  uneVtkImage3D->DeepCopy(vtkObj);
    
  // transform PolyData to StructuredPoints
  vtkImageToStructuredPoints *i2sp = vtkImageToStructuredPoints::New();
  i2sp->SetInput(uneVtkImage3D);   
   
  // write StructuredPoints image
  vtkImageWriter* writerImageSP = vtkImageWriter::New();
  writerImageSP->SetInput(i2sp->GetOutput());
  writerImageSP->SetFileName(sortie);
  writerImageSP->SetFileDimensionality(3);
  writerImageSP->Write();
  writerImageSP->Update();
  std::cout <<"writer SP"<&lt;std::endl;
&lt;/h2&gt;
Thanks a lot
Best regards
Maroua

--
View this message in context: http://vtk.1045678.n5.nabble.com/problem-empty-file-in-converting-PolyData-to-StructuredPoints-tp4399848p4399848.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list