[ITK-users] ImageSeriesWriter | SimpleITK

Bradley Lowekamp blowekamp at mail.nih.gov
Tue Mar 24 14:12:47 EDT 2015


Hello,

On Mar 24, 2015, at 1:56 PM, Matias Montroull <matimontg at gmail.com> wrote:

> //Here's where I struggle...
>             vs.Add(path_pacientes + nombre_paciente + @"\Fusion\SalidaTest\imagen%03d.dcm"); //Is this rthe right way to include a vector of strings


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.

Many languages have convenient generator expressions or list comprehensions, which seems more natural than C printf formatting and the perils associated with it.

The long way to do it is just write a little for loop, something like:

for (i=0; i < img.GetSize()[2], ++i)
	vs.Add( "name {0}.ext".Format(i))

Brad

[1] https://github.com/SimpleITK/SimpleITK/blob/master/Testing/Unit/IOTests.cxx#L123-L152

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20150324/181afae8/attachment.html>


More information about the Insight-users mailing list