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

maroua maroua.mehri at gmail.com
Mon May 16 06:24:19 EDT 2011


I modify my code
  // 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);   
  
  // declaration a new objet VtkImageData
  vtkImageData *vtkObj2 = vtkImageData::New();
  vtkObj2=(vtkImageData*)i2sp->GetOutput();
   
  // write StructuredPoints image
  vtkImageWriter* writerImageSP = vtkImageWriter::New();
  writerImageSP->SetInput(vtkObj2);
  writerImageSP->SetFileName(sortie);
  writerImageSP->SetFileDimensionality(3);
  writerImageSP->Write();
  writerImageSP->Update();
  std::cout <<"writer SP"<&lt;std::endl;
And I obtain an error 
&lt;b&gt;ERROR: In /build/buildd/vtk-5.4.2/IO/vtkImageWriter.cxx, line 427
vtkImageWriter (0xa04dab8): Could not get data from input.
I don't know haw could I correct it
I need your help
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-tp4399848p4399972.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list