<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
<br>Hi guys,<br>I need your help. I want convert my itkmesh to vtkPolydata and after I want to write it in "ojo.vtk". But, when I try it the mistake appears. Can you help me??<br><br><br>int main(int argc, char * argv[] ) <br>{<br><br> if( argc < 3 )<br> {<br> std::cerr << "Usage: IsoSurfaceExtraction inputImageFile objectValue" << std::endl;<br> return EXIT_FAILURE;<br> }<br><br> const unsigned int Dimension = 3;<br> typedef signed short PixelType;<br><br> typedef itk::Image< PixelType, Dimension > ImageType;<br><br> typedef itk::ImageFileReader< ImageType > ReaderType;<br> ReaderType::Pointer reader = ReaderType::New();<br> reader->SetFileName( argv[1] );<br><br> try<br> {<br> reader->Update();<br> }<br> catch( itk::ExceptionObject & exp )<br> {<br> std::cerr << "Exception thrown while reading the input file " << std::endl;<br> std::cerr << exp << std::endl;<br> return EXIT_FAILURE;<br> }<br> <br> typedef itk::DefaultDynamicMeshTraits<double, 3, 3,double,double> TriangleMeshTraits; ///////////////<br> typedef itk::Mesh<double,3, TriangleMeshTraits> MeshType;<br> typedef itk::BinaryMask3DMeshSource< ImageType, MeshType > MeshSourceType;<br><br> MeshSourceType::Pointer meshSource = MeshSourceType::New();<br> <br> const PixelType objectValue = static_cast<PixelType>( atof( argv[2] ) );<br> meshSource->SetObjectValue( objectValue );<br> meshSource->SetInput( reader->GetOutput() );<br><br> try<br> {<br> meshSource->Update();<br> }<br> catch( itk::ExceptionObject & exp )<br> {<br> std::cerr << "Exception thrown during Update() " << std::endl;<br> std::cerr << exp << std::endl;<br> return EXIT_FAILURE;<br> }<br><br> std::cout << "Nodes = " << meshSource->GetNumberOfNodes() << std::endl;<br> std::cout << "Cells = " << meshSource->GetNumberOfCells() << std::endl;<br><br>vtkPolyData *vtkPolyDataOut = NULL;<br>itkMeshTovtkPolyData * itkMesh2PolyData = new itkMeshTovtkPolyData();<br>itkMesh2PolyData->SetInput (meshSource->GetOutput());<br>vtkPolyDataOut = itkMesh2PolyData->GetOutput();<br><br>typedef itk::VTKPolyDataWriter<MeshType>WriterType; <br>WriterType::Pointer writer1 = WriterType::New();<br><br>write1->SetInput(vtkPolyDataOut); /////////////////////////////////// ERROR<br>writer1->SetFileName( "ojo.vtk" );<br><br> try<br> {<br> writer1->Update();<br> }<br> catch( itk::ExceptionObject & exp )<br> {<br> std::cerr << "Exception thrown during Update() " << std::endl;<br> std::cerr << exp << std::endl;<br> return EXIT_FAILURE;<br> }<br><br>writer1->Delete();<br>return 0;<br><br> return EXIT_SUCCESS;<br>}<br><br><br>thanks for your help.<br><br /><hr />Diferentes formas de estar en contacto con amigos y familiares. Descúbrelas. <a href='http://www.microsoft.com/windows/windowslive/default.aspx' target='_new'>Descúbrelas.</a></body>
</html>