Hi xiaoping,<br>Sorry, I didn&#39;t read the question carefully. The trick from Sergio also &nbsp;helps me. Thanks.<br>Best,<br>Cheng<br><br>----- Reply message -----<br>From: &quot;Xiaopeng Yang&quot; &lt;yxp233@postech.ac.kr&gt;<br>Date: Tue, Aug 3, 2010 11:16<br>Subject: [Insight-users] About SetFileName in for loop<br>To: &quot;&#39;Sergio Vera&#39;&quot; &lt;sergio.vera@alma3d.com&gt;<br>Cc: &quot;&#39;itk&#39;&quot; &lt;Insight-users@itk.org&gt;<br><br><br>Hi Sergio,<br><br> <br><br>It works well. Thank you very much for your help.<br><br> <br><br>Best wishes,<br><br>Xiaopeng<br><br> <br><br>发件人: Sergio Vera [mailto:sergio.vera@alma3d.com] <br>发送时间: Tuesday, August 03, 2010 6:06 PM<br>收件人: Xiaopeng Yang<br>抄送: itk<br>主题: Re: [Insight-users] About SetFileName in for loop<br><br> <br><br>Hi Xiaopeng<br><br>this is more a general C++ question than itk, but I guess you can do something like that:<br><br> <br><br>(inside the loop)<br><br> <br><br>std::stringstream filename;<br><br>filename &lt;&lt; &quot;D:\\fast_marching_simulation\\3D&quot; &lt;&lt; sigma&lt;&lt; &quot;.dcm&quot;;<br><br>writer-&gt;SetFileName( filename.str() );<br><br> <br><br> <br><br>thus, adding each time the sigma value to the filename .<br><br> <br><br> <br><br>Hope it helps<br><br> <br><br>Regards<br><br> <br><br>On Tue, Aug 3, 2010 at 10:52 AM, Xiaopeng Yang &lt;yxp233@postech.ac.kr&gt; wrote:<br><br>Hi ITK users,<br><br> <br><br>In the fast marching level set method, I tried to program a simulation process for changing parameter “sigma” to get different outputs. Thus I tried for loop. The problem is how to save the different results in different file names. I think I need to change the code of “SetFileName”. If I do not change it, then the later result will replace the previous result automatically. Anyone has any good idea? <br><br> <br><br>for (double sigma = 1.0; sigma &lt;=1.4; sigma += .1) {<br><br> <br><br>...<br><br> <br><br>writer-&gt;SetFileName( &quot;D:/fast_marching_simulation/3D.dcm&quot; );<br><br> <br><br>...<br><br> <br><br>}<br><br> <br><br>Thank you very much!<br><br> <br><br>Xiaopeng<br><br><br>_____________________________________<br>Powered by www.kitware.com<br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br><a href="http://www.kitware.com/products/protraining.html">http://www.kitware.com/products/protraining.html</a><br><br>Please keep messages on-topic and check the ITK FAQ at:<br><a href="http://www.itk.org/Wiki/ITK_FAQ">http://www.itk.org/Wiki/ITK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a><br><br><br><br><br>-- <br>Sergio Vera<br><br> Alma IT Systems<br> C/ Vilana, 4B, 4º 1ª<br> 08022 Barcelona<br> T. (+34) 932 380 592<br> www.alma3d.com<br><br><br><br>