<div>Hi Xiaopeng</div>this is more a general C++ question than itk, but I guess you can do something like that:<div><br></div><div>(inside the loop)</div><div><br></div><div><div><font class="Apple-style-span" face="'courier new', monospace">std::stringstream filename;</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">filename << "</font><span class="Apple-style-span" style="font-size: 13px; "><font class="Apple-style-span" face="'courier new', monospace">D:\\fast_marching_simulation\\3D</font></span><font class="Apple-style-span" face="'courier new', monospace">" << sigma<< ".dcm";</font></div>
<div><span class="Apple-style-span" style="font-size: 13px; "><font class="Apple-style-span" face="'courier new', monospace">writer->SetFileName( filename.str() );</font></span></div><div><span class="Apple-style-span" style="font-size: 13px; "><font class="Apple-style-span" face="'courier new', monospace"><br>
</font></span></div><div><span class="Apple-style-span" style="font-size: 13px; "><font class="Apple-style-span" face="'courier new', monospace"><br></font></span></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">thus, adding each time the sigma value to the filename .</font></div>
<div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">Hope it helps</font></div>
<div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">Regards</font></div><br><div class="gmail_quote">On Tue, Aug 3, 2010 at 10:52 AM, Xiaopeng Yang <span dir="ltr"><<a href="mailto:yxp233@postech.ac.kr">yxp233@postech.ac.kr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal">Hi ITK users,</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">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? </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:blue">for</span><span style="font-size:10.0pt;font-family:"Courier New"">
(<span style="color:blue">double</span> sigma = 1.0; sigma <=1.4; sigma +=
.1) {</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New""> </span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">...</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New""> </span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">writer->SetFileName(
"D:/fast_marching_simulation/3D.dcm" );</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New""> </span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">...</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New""> </span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">}</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New""> </span></p>
<p class="MsoNormal">Thank you very much!</p>
<p class="MsoNormal"> </p><font color="#888888">
<p class="MsoNormal">Xiaopeng</p>
</font></div>
</div>
<br>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">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" target="_blank">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" target="_blank">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" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br><br clear="all"><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> <a href="http://www.alma3d.com">www.alma3d.com</a><br>
</div>