<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>&nbsp; if( argc &lt; 3 )<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; "Usage: IsoSurfaceExtraction&nbsp; inputImageFile&nbsp;&nbsp; objectValue" &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp; return EXIT_FAILURE;<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp; const unsigned int Dimension = 3;<br>&nbsp; typedef signed short PixelType;<br><br>&nbsp; typedef itk::Image&lt; PixelType, Dimension &gt;&nbsp;&nbsp; ImageType;<br><br>&nbsp; typedef itk::ImageFileReader&lt; ImageType &gt;&nbsp;&nbsp;&nbsp; ReaderType;<br>&nbsp; ReaderType::Pointer reader = ReaderType::New();<br>&nbsp; reader-&gt;SetFileName( argv[1] );<br><br>&nbsp; try<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; reader-&gt;Update();<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp; catch( itk::ExceptionObject &amp; exp )<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; "Exception thrown while reading the input file " &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; exp &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp; return EXIT_FAILURE;<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp; <br>&nbsp; typedef itk::DefaultDynamicMeshTraits&lt;double, 3, 3,double,double&gt; TriangleMeshTraits; ///////////////<br>&nbsp; typedef itk::Mesh&lt;double,3, TriangleMeshTraits&gt; MeshType;<br>&nbsp; typedef itk::BinaryMask3DMeshSource&lt; ImageType, MeshType &gt; MeshSourceType;<br><br>&nbsp; MeshSourceType::Pointer meshSource = MeshSourceType::New();<br>&nbsp; <br>&nbsp; const PixelType objectValue = static_cast&lt;PixelType&gt;( atof( argv[2] ) );<br>&nbsp; meshSource-&gt;SetObjectValue( objectValue );<br>&nbsp; meshSource-&gt;SetInput( reader-&gt;GetOutput() );<br><br>&nbsp; try<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; meshSource-&gt;Update();<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp; catch( itk::ExceptionObject &amp; exp )<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; "Exception thrown during Update() " &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; exp &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp; return EXIT_FAILURE;<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp; std::cout &lt;&lt; "Nodes = " &lt;&lt; meshSource-&gt;GetNumberOfNodes() &lt;&lt; std::endl;<br>&nbsp; std::cout &lt;&lt; "Cells = " &lt;&lt; meshSource-&gt;GetNumberOfCells() &lt;&lt; std::endl;<br><br>vtkPolyData *vtkPolyDataOut = NULL;<br>itkMeshTovtkPolyData * itkMesh2PolyData = new itkMeshTovtkPolyData();<br>itkMesh2PolyData-&gt;SetInput (meshSource-&gt;GetOutput());<br>vtkPolyDataOut = itkMesh2PolyData-&gt;GetOutput();<br><br>typedef itk::VTKPolyDataWriter&lt;MeshType&gt;WriterType; <br>WriterType::Pointer writer1 = WriterType::New();<br><br>write1-&gt;SetInput(vtkPolyDataOut);&nbsp; ///////////////////////////////////&nbsp; ERROR<br>writer1-&gt;SetFileName( "ojo.vtk" );<br><br>&nbsp; try<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; writer1-&gt;Update();<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp; catch( itk::ExceptionObject &amp; exp )<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; "Exception thrown during Update() " &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; exp &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp; return EXIT_FAILURE;<br>&nbsp;&nbsp;&nbsp; }<br><br>writer1-&gt;Delete();<br>return 0;<br><br>&nbsp; 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>