<!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> </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 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> </DIV>
<DIV><SPAN class=359281809-13062006><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> itk::Image <
</FONT><FONT color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>char</FONT><FONT size=2>, 2 > Image2DType;</P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2>
itk::ImageSeriesWriter < ImageType, Image2DType > 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()->getItkImage();</P>
<P>ImageType::RegionType region = inputImage->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->SetSeriesFormat( format.c_str() );</P>
<P>nameGenerator->SetStartIndex( firstSlice );</P>
<P>nameGenerator->SetEndIndex( lastSlice );</P>
<P>nameGenerator->SetIncrementIndex( 1 );</P>
<P>WriterType::Pointer writer = WriterType::New();</P>
<P>writer->SetFileNames( nameGenerator->GetFileNames() );</P>
<P>writer->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>
</SPAN>writer->Update();</FONT></P>
<P><FONT size=2>}</FONT></P>
<P><FONT color=#0000ff size=2>catch</FONT><FONT size=2>( itk::ExceptionObject
& excp ) {</FONT></P>
<P><FONT size=2><SPAN class=359281809-13062006>
</SPAN>std::cerr << excp << std::endl;</FONT></P>
<P><FONT size=2>}</FONT></P></SPAN></DIV>
<DIV><SPAN class=359281809-13062006><FONT face=Verdana
size=2></FONT></SPAN> </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> </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> </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> </DIV>
<DIV><SPAN class=359281809-13062006><FONT face=Verdana
size=2>thanks</FONT></SPAN></DIV></BODY></HTML>