<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Hi all,<BR>
I write a piont set by ofstream like this:<BR>
&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef itk::PointSet&lt; float, Dimension &gt;&nbsp;&nbsp; PointSetType;<BR>
&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef PointSetType::PointType&nbsp;&nbsp;&nbsp;&nbsp; PointType;<BR>
&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; "begin write point set ..." &lt;&lt; std::endl;<BR>
&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::ofstream skeltonPointsFile;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; skeltonPointsFile.open( argv[7] );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef PointSetType::PointsContainer PointsContainer;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PointsContainer::Pointer points = SkelPointSet-&gt;GetPoints();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef PointsContainer::Iterator&nbsp;&nbsp;&nbsp;&nbsp; PointsIterator;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PointsIterator&nbsp; pointIterator = points-&gt;Begin();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PointsIterator end = points-&gt;End();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while( pointIterator != end ) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PointType p = pointIterator.Value();&nbsp;&nbsp; // access the point<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; skeltonPointsFile &lt;&lt; p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // print the point<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ++pointIterator;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; skeltonPointsFile.close();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; "write point set done..." &lt;&lt; std::endl;<BR>
&nbsp;<BR>
&nbsp;<BR>
I can open the pointset txt file, the points are saved as following format:<BR>
[-104.98, -144.511, -1035.9][133.301, -144.511, -1035.9]<BR>
&nbsp;<BR>
when I want to read it out to a pointset, my code as folloing:<BR>
&nbsp;<BR>
typedef itk::PointSet&lt; float, Dimension &gt;&nbsp;&nbsp; PointSetType;<BR>
typedef PointSetType::PointType&nbsp;&nbsp;&nbsp;&nbsp; PointType;<BR>
PointType fixedPoint;<BR>
&nbsp;<BR>
&nbsp;std::ifstream&nbsp;&nbsp; fixedFile;<BR>&nbsp;&nbsp;&nbsp; fixedFile.open( argv[1] );<BR>&nbsp;&nbsp;&nbsp; if( fixedFile.fail() )<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; "Error opening points file with name : " &lt;&lt; std::endl;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; argv[1] &lt;&lt; std::endl;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 2;<BR>&nbsp;&nbsp;&nbsp; }<BR>
unsigned int pointId = 0;<BR>&nbsp;&nbsp;&nbsp; fixedFile &gt;&gt; fixedPoint;<BR>&nbsp;&nbsp;&nbsp; while( !fixedFile.eof() )<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fixedPointContainer-&gt;InsertElement( pointId, fixedPoint );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fixedFile &gt;&gt; fixedPoint;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pointId++;<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; fixedPointSet-&gt;SetPoints( fixedPointContainer );<BR>&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "Number of fixed Points = " &lt;&lt; fixedPointSet-&gt;GetNumberOfPoints() <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;&lt; std::endl;<BR>
&nbsp;<BR>
But I can not read the points correctly, dose anyone can help me?<BR>
Thx.<RTE_TEXT></RTE_TEXT><BR><br /><hr />八卦娱乐包打听,MSN资讯速递帮你忙! <a href='http://im.live.cn/newsexpress' target='_new'>了解详细!</a></body>
</html>