<div dir="ltr">Thanks Bradley,<div><br></div><div>So, I did this:</div><div><br></div><div><div>      ImageFileReader imgreader = new ImageFileReader();</div><div>            imgreader.SetFileName(path_pacientes + nombre_paciente + @"\Fusion\" + "resultado.mha");</div><div>            itk.simple.Image imgtest = imgreader.Execute();</div><div>            ImageSeriesWriter SeriesWriter = new ImageSeriesWriter();</div><div>            VectorString vs = new VectorString();</div><div>            for (int i=0; i < imgtest.GetSize()[2]; ++i) </div><div>            {</div><div>                vs.Add("imagen {0}.dcm");</div><div>            }</div><div><br></div><div>            SeriesWriter.SetFileNames(vs);</div><div>            SeriesWriter.Execute(imgtest, vs, false);</div></div><div><br></div><div>And I only get one file name (imagen {0}.dcm), am I missing something? (I wasn't able to do this: <span style="font-size:12.8000001907349px">"name {0}.ext".Format(i))</span></div><div><br></div><div>Thanks,</div><div><br></div><div>Matias.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 24, 2015 at 3:12 PM, Bradley Lowekamp <span dir="ltr"><<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hello,<div><span class=""><br><div><div>On Mar 24, 2015, at 1:56 PM, Matias Montroull <<a href="mailto:matimontg@gmail.com" target="_blank">matimontg@gmail.com</a>> wrote:</div><br><blockquote type="cite"><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">//Here's where I struggle...</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">            vs.Add(path_pacientes + nombre_paciente + @"\Fusion\SalidaTest\imagen%03d.dcm"); //Is this rthe right way to include a vector of strings</div></blockquote><br></div><div><br></div></span><div>No that is not the write way. You actually need to create the list for file names. You needs something closer to what's here in the C++ test [1] but converted to CSharp. The length of the list must match the z size of the images.</div><div><br></div><div>Many languages have convenient generator expressions or list comprehensions, which seems more natural than C printf formatting and the perils associated with it.</div><div><br></div><div>The long way to do it is just write a little for loop, something like:</div><div><br></div><div>for (i=0; i < img.GetSize()[2], ++i)</div><div><span style="white-space:pre-wrap">      </span>vs.Add( "name {0}.ext".Format(i))</div><div><br></div><div>Brad</div><div><br></div><div>[1] <a href="https://github.com/SimpleITK/SimpleITK/blob/master/Testing/Unit/IOTests.cxx#L123-L152" target="_blank">https://github.com/SimpleITK/SimpleITK/blob/master/Testing/Unit/IOTests.cxx#L123-L152</a></div><br></div></div></blockquote></div><br></div>