<div>hello</div>
<div>I&nbsp;follow the instruction of itk user guide&nbsp;to writer the processed series images into series dcm images, but exception is thrown out:</div>
<div>&nbsp;</div>
<div>Exception thrown while reading the image</div>
<div>itk::exceptionObject [0147F010]</div>
<div>location &quot;unknown&quot;</div>
<div>File: D:\Program Files\ITK\InsightToolkit\Examples\IO\itkImageSeriesWriter.txx</div>
<div>Line: 314</div>
<div>Description: itk::Error: ImageSeriesWriter&lt;036E0000&gt;::The number of filter names passed is 21 but 1 were excepted.</div>
<div>(I read 21 slice images)</div>
<div>&nbsp;</div>
<div>My code is as follow:</div>
<div>typedef itk::ImageSeriesWriter&lt; ImageType3D, ImageType &gt; WriterType;<br>&nbsp;WriterType::Pointer writer = WriterType::New();<br>&nbsp;<br>&nbsp;typedef itk::GDCMImageIO&nbsp;ImageIOType;<br>&nbsp;ImageIOType::Pointer gdcmImageIO=ImageIOType::New();<br>
&nbsp;<br>&nbsp;writer-&gt;SetImageIO(gdcmImageIO);<br>&nbsp;writer-&gt;SetInput( SeriesReader-&gt;GetOutput() );&nbsp; <br>&nbsp;// Connect an observer<br>&nbsp;ImageProcessUpdate::Pointer observer = ImageProcessUpdate::New();<br>&nbsp;writer-&gt;AddObserver( itk::ProgressEvent(), observer );<br>
&nbsp;<br>&nbsp;typedef itk::NumericSeriesFileNames&nbsp;&nbsp;&nbsp; NameGeneratorType;<br>&nbsp;<br>&nbsp;NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();<br>&nbsp;<br>&nbsp;std::string format = &quot;ProcessedImg&quot;;<br>&nbsp;format += &quot;%03d.&quot;;<br>
&nbsp;format += &quot;dcm&quot;;&nbsp;&nbsp;&nbsp;<br>&nbsp;<br>&nbsp;nameGenerator-&gt;SetSeriesFormat( format.c_str() );<br>&nbsp;&nbsp;<br>&nbsp;ImageType3D::ConstPointer inputImage = SeriesReader-&gt;GetOutput();<br>&nbsp;ImageType3D::RegionType&nbsp;&nbsp; region&nbsp;&nbsp;&nbsp;&nbsp; = inputImage-&gt;GetLargestPossibleRegion();<br>
&nbsp;ImageType3D::IndexType&nbsp;&nbsp;&nbsp; start&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = region.GetIndex(); <br>&nbsp;ImageType3D::SizeType&nbsp;&nbsp;&nbsp;&nbsp; size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = region.GetSize(); <br>&nbsp;<br>&nbsp;const unsigned int firstSlice = start[2];<br>&nbsp;const unsigned int lastSlice&nbsp; = start[2] + size[2] - 1 ;<br>
&nbsp;<br>&nbsp;nameGenerator-&gt;SetStartIndex( firstSlice );<br>&nbsp;nameGenerator-&gt;SetEndIndex( lastSlice );<br>&nbsp;nameGenerator-&gt;SetIncrementIndex( 1 );<br>&nbsp;<br>&nbsp;writer-&gt;SetFileNames( nameGenerator-&gt;GetFileNames() );<br>&nbsp;try<br>
&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;writer-&gt;Update();<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;catch( itk::ExceptionObject &amp; excp )<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;std::cerr &lt;&lt; &quot;Exception thrown while reading the image&quot; &lt;&lt; std::endl;<br>&nbsp;&nbsp;std::cerr &lt;&lt; excp &lt;&lt; std::endl;<br>
&nbsp;&nbsp;&nbsp; }</div>