<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2873" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=359281809-13062006><FONT face=Verdana size=2>hi to 
all,</FONT></SPAN></DIV>
<DIV><SPAN class=359281809-13062006><FONT face=Verdana 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=359281809-13062006><FONT face=Verdana size=2>I must write a 
procedure that takes in income a series (or a single image) of images and it 
save&nbsp;them on disc and I have used the following code, </FONT></SPAN></DIV>
<DIV><SPAN class=359281809-13062006><FONT face=Verdana 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=359281809-13062006><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> itk::Image &lt; 
</FONT><FONT color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT 
color=#0000ff size=2>char</FONT><FONT size=2>, 2 &gt; Image2DType;</P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> 
itk::ImageSeriesWriter &lt; ImageType, Image2DType &gt; WriterType;</P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> 
itk::NumericSeriesFileNames NameGeneratorType;</P>
<P>itksys::SystemTools::MakeDirectory( cartella.c_str() );</P>
<P>std::string format = cartella;</P>
<P>format += "\\";</P>
<P>format += nomeFile;</P>
<P>format += "%03d.dcm";</P>
<P>ImageType::ConstPointer inputImage = getItkVtkData()-&gt;getItkImage();</P>
<P>ImageType::RegionType region = inputImage-&gt;GetLargestPossibleRegion();</P>
<P>ImageType::IndexType start = region.GetIndex();</P>
<P>ImageType::SizeType size = region.GetSize();</P>
<P></FONT><FONT color=#0000ff size=2>const</FONT><FONT size=2> </FONT><FONT 
color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff 
size=2>int</FONT><FONT size=2> firstSlice = start[2];</P>
<P></FONT><FONT color=#0000ff size=2>const</FONT><FONT size=2> </FONT><FONT 
color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff 
size=2>int</FONT><FONT size=2> lastSlice = start[2] + size[2] - 1;</P>
<P>NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();</P>
<P>nameGenerator-&gt;SetSeriesFormat( format.c_str() );</P>
<P>nameGenerator-&gt;SetStartIndex( firstSlice );</P>
<P>nameGenerator-&gt;SetEndIndex( lastSlice );</P>
<P>nameGenerator-&gt;SetIncrementIndex( 1 );</P>
<P>WriterType::Pointer writer = WriterType::New();</P>
<P>writer-&gt;SetFileNames( nameGenerator-&gt;GetFileNames() );</P>
<P>writer-&gt;SetInput( inputImage );</P>
<P></FONT><FONT color=#0000ff size=2>try</FONT><FONT size=2> {</FONT></P>
<P><FONT size=2><SPAN class=359281809-13062006>&nbsp;&nbsp;&nbsp; 
</SPAN>writer-&gt;Update();</FONT></P>
<P><FONT size=2>}</FONT></P>
<P><FONT color=#0000ff size=2>catch</FONT><FONT size=2>( itk::ExceptionObject 
&amp; excp ) {</FONT></P>
<P><FONT size=2><SPAN class=359281809-13062006>&nbsp;&nbsp;&nbsp; 
</SPAN>std::cerr &lt;&lt; excp &lt;&lt; std::endl;</FONT></P>
<P><FONT size=2>}</FONT></P></SPAN></DIV>
<DIV><SPAN class=359281809-13062006><FONT face=Verdana 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=359281809-13062006><FONT face=Verdana size=2>however it does 
not work and it places in escape the eguente exception: </FONT></SPAN></DIV>
<DIV><SPAN class=359281809-13062006><FONT face=Verdana 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=359281809-13062006><FONT face=Verdana size=2>"itk::ERROR: 
ImageSeriesWriter(0A05BCB8): The number of filenames passed is 15 but 1 were 
expected"</FONT></SPAN></DIV>
<DIV><SPAN class=359281809-13062006><FONT face=Verdana 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=359281809-13062006><FONT face=Verdana size=2>If someone has 
some suggestion I accept.</FONT></SPAN></DIV>
<DIV><SPAN class=359281809-13062006><FONT face=Verdana 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=359281809-13062006><FONT face=Verdana 
size=2>thanks</FONT></SPAN></DIV></BODY></HTML>