<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV>Hi Dan,</DIV>
<DIV>Thank you for your help. the code is working I've just added pointer incrementation statment in both loops.</DIV>
<DIV>Regards</DIV>
<DIV>Marion<BR><BR>--- En date de&nbsp;: <B>Lun 8.6.09, Dan Mueller <I>&lt;dan.muel@gmail.com&gt;</I></B> a écrit&nbsp;:<BR></DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid"><BR>De: Dan Mueller &lt;dan.muel@gmail.com&gt;<BR>Objet: Re: [Insight-users] how to copy a mesh? newbie<BR>À: marion.rizet@yahoo.fr<BR>Cc: insight-users@itk.org<BR>Date: Lundi 8 Juin 2009, 19h51<BR><BR>
<DIV class=plainMail>Hi Marion,<BR><BR>&nbsp; &nbsp; Welcome to ITK!<BR><BR>One way to copy your mesh is to iterate and copy the points/cells<BR><BR>#include "itkCellInterface.h"<BR>#include "itkDefaultStaticMeshTraits.h"<BR>#include "itkMesh.h"<BR><BR>int main( int argc, char *argv[] )<BR>{<BR>&nbsp; &nbsp; typedef itk::Mesh &lt; float,3,itk::DefaultStaticMeshTraits&lt;<BR>float,3,3,float &gt; &gt; MeshType;<BR>&nbsp; &nbsp; MeshType::Pointer mesh = MeshType::New(); // You need to<BR>initialise the mesh to copy<BR>&nbsp; &nbsp; MeshType::Pointer copy = MeshType::New(); // This is the copied mesh<BR>&nbsp; &nbsp; MeshType::PointsContainerPointer points = mesh-&gt;GetPoints( );<BR>&nbsp; &nbsp; MeshType::PointsContainerConstIterator it = points-&gt;Begin();<BR>&nbsp; &nbsp; MeshType::PointsContainerConstIterator itEnd = points-&gt;End();<BR>&nbsp; &nbsp; unsigned int i = 0;<BR>&nbsp; &nbsp; while ( it != itEnd )<BR>&nbsp; &nbsp; {<BR>&nbsp; &nbsp; &nbsp;
 &nbsp; MeshType::PointType point = it.Value();<BR>&nbsp; &nbsp; &nbsp; &nbsp; copy-&gt;SetPoint( i++, point );<BR>&nbsp; &nbsp; }<BR><BR>&nbsp; &nbsp; i = 0;<BR>&nbsp; &nbsp; MeshType::CellsContainerPointer cells = mesh-&gt;GetCells( );<BR>&nbsp; &nbsp; MeshType::CellsContainerConstIterator itCells = cells-&gt;Begin();<BR>&nbsp; &nbsp; MeshType::CellsContainerConstIterator itCellsEnd = cells-&gt;End();<BR>&nbsp; &nbsp; while ( itCells != itCellsEnd )<BR>&nbsp; &nbsp; {<BR>&nbsp; &nbsp; &nbsp; &nbsp; MeshType::CellType::CellAutoPointer cellCopy;<BR>&nbsp; &nbsp; &nbsp; &nbsp; itCells.Value()-&gt;MakeCopy( cellCopy );<BR>&nbsp; &nbsp; &nbsp; &nbsp; copy-&gt;SetCell( i++, cellCopy );<BR>&nbsp; &nbsp; }<BR>}<BR><BR>Disclaimer: I haven't fully tested the above code, but it should get<BR>you started.<BR><BR>Hope this helps.<BR><BR>Cheers, Dan<BR><BR><BR>2009/6/8&nbsp; &lt;<A href="http://fr.mc246.mail.yahoo.com/mc/compose?to=marion.rizet@yahoo.fr"
 ymailto="mailto:marion.rizet@yahoo.fr">marion.rizet@yahoo.fr</A>&gt;:<BR>&gt; Hi all,<BR>&gt;<BR>&gt; I would like to create a new mesh from an existing mesh(which is an input to<BR>&gt; my code). The new mesh that I want to create should has the same data except<BR>&gt; the values (the points value) which are different. How can I do that? Is<BR>&gt; there way or method to copy a mesh (points , cells,..) ?. please could you<BR>&gt; give me help, I’m a bit lost with itk as I’m&nbsp; new.<BR>&gt;<BR>&gt;<BR>&gt;<BR>&gt; Thank you<BR>&gt;<BR>&gt; Marion<BR>&gt;<BR>&gt; _____________________________________<BR>&gt; Powered by www.kitware.com<BR>&gt;<BR>&gt; Visit other Kitware open-source projects at<BR>&gt; <A href="http://www.kitware.com/opensource/opensource.html" target=_blank>http://www.kitware.com/opensource/opensource.html</A><BR>&gt;<BR>&gt; Please keep messages on-topic and check the ITK FAQ at:<BR>&gt; <A href="http://www.itk.org/Wiki/ITK_FAQ"
 target=_blank>http://www.itk.org/Wiki/ITK_FAQ</A><BR>&gt;<BR>&gt; Follow this link to subscribe/unsubscribe:<BR>&gt; <A href="http://www.itk.org/mailman/listinfo/insight-users" target=_blank>http://www.itk.org/mailman/listinfo/insight-users</A><BR>&gt;<BR>&gt;<BR></DIV></BLOCKQUOTE></td></tr></table><br>