[Insight-users] About SetFileName in for loop

Qian Cheng qianc at ee.ethz.ch
Tue Aug 3 05:29:39 EDT 2010


Hi xiaoping,
Sorry, I didn't read the question carefully. The trick from Sergio also  helps me. Thanks.
Best,
Cheng

----- Reply message -----
From: "Xiaopeng Yang" <yxp233 at postech.ac.kr>
Date: Tue, Aug 3, 2010 11:16
Subject: [Insight-users] About SetFileName in for loop
To: "'Sergio Vera'" <sergio.vera at alma3d.com>
Cc: "'itk'" <Insight-users at itk.org>


Hi Sergio,

 

It works well. Thank you very much for your help.

 

Best wishes,

Xiaopeng

 

发件人: Sergio Vera [mailto:sergio.vera at alma3d.com] 
发送时间: Tuesday, August 03, 2010 6:06 PM
收件人: Xiaopeng Yang
抄送: itk
主题: Re: [Insight-users] About SetFileName in for loop

 

Hi Xiaopeng

this is more a general C++ question than itk, but I guess you can do something like that:

 

(inside the loop)

 

std::stringstream filename;

filename << "D:\\fast_marching_simulation\\3D" << sigma<< ".dcm";

writer->SetFileName( filename.str() );

 

 

thus, adding each time the sigma value to the filename .

 

 

Hope it helps

 

Regards

 

On Tue, Aug 3, 2010 at 10:52 AM, Xiaopeng Yang <yxp233 at postech.ac.kr> wrote:

Hi ITK users,

 

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? 

 

for (double sigma = 1.0; sigma <=1.4; sigma += .1) {

 

...

 

writer->SetFileName( "D:/fast_marching_simulation/3D.dcm" );

 

...

 

}

 

Thank you very much!

 

Xiaopeng


_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.html

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-users




-- 
Sergio Vera

 Alma IT Systems
 C/ Vilana, 4B, 4º 1ª
 08022 Barcelona
 T. (+34) 932 380 592
 www.alma3d.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100803/e64a4eac/attachment.htm>


More information about the Insight-users mailing list