<div dir="ltr">Hi,<br><br>Thank you very much for your response Luis.<br>Meanwhile, I&#39;ve used the NaryAddImageFilter to resolve my problem.<br>Here is the code for those that could be interrested in the subject :<br><br>
<br><br><br><br>&nbsp;#include &quot;itkImage.h&quot;<br>&nbsp;#include &quot;itkImageFileReader.h&quot;<br>&nbsp;#include &quot;itkImageFileWriter.h&quot;<br>&nbsp;#include &quot;itkAddImageFilter.h&quot;<br>&nbsp;#include &quot;itkImageIOBase.h&quot;<br>
&nbsp;#include &quot;itkNaryAddImageFilter.h&quot;<br><br>&nbsp;int main( int argc, char * argv[] )<br><br>&nbsp;{<br><br>&nbsp;if( argc &lt; 4 )<br><br>&nbsp;{<br><br>&nbsp;std::cerr &lt;&lt; &quot;Usage: &quot; &lt;&lt; std::endl;<br><br>&nbsp;std::cerr &lt;&lt; argv[0] &lt;&lt; &quot; Image1 Image2 [ImageX]* ImageOutput&quot; &lt;&lt; std::endl;<br>
<br>&nbsp;return EXIT_FAILURE;<br><br>&nbsp;}<br><br>&nbsp;typedef&nbsp;&nbsp; unsigned int PixelType; // be sure it&#39;s the good type !!<br>&nbsp;<br>&nbsp;typedef itk::Image&lt; PixelType, 3 &gt; ImageType;<br>&nbsp;<br>&nbsp;typedef itk::ImageFileReader&lt; ImageType &gt; ReaderType;<br>
<br>&nbsp;typedef itk::ImageFileWriter&lt; ImageType &gt; WriterType;<br><br>&nbsp;typedef itk::NaryAddImageFilter&lt; ImageType,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; ImageType &gt; AddFilterType;<br>&nbsp;<br>&nbsp;int nbImages = argc - 2;<br>
&nbsp;<br>&nbsp;ReaderType::Pointer reader = ReaderType::New();<br>&nbsp;<br>&nbsp;AddFilterType::Pointer addition = AddFilterType::New();<br>&nbsp;<br>&nbsp;std::cout &lt;&lt; std::endl;<br>&nbsp;<br>&nbsp;for (int i = 0 ; i &lt; nbImages ; i++)<br>{&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; reader-&gt;SetFileName( argv[i+1] );<br>
&nbsp;&nbsp;&nbsp; reader-&gt;Update();<br>&nbsp;&nbsp;&nbsp; addition-&gt;SetInput( i , reader-&gt;GetOutput() );<br>&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; &quot;Image n°&quot; &lt;&lt; i+1 &lt;&lt; &quot; [&quot; &lt;&lt; argv[i+1] &lt;&lt; &quot;] added&quot; &lt;&lt; std::endl &lt;&lt; std::endl;<br>
}<br><br>&nbsp;addition-&gt; Update();<br><br>&nbsp;WriterType::Pointer writer = WriterType::New();<br>&nbsp;<br>&nbsp;writer-&gt;SetFileName( argv[nbImages+1] );<br><br>&nbsp;writer-&gt;SetInput(addition-&gt;GetOutput());<br><br>&nbsp;std::cout &lt;&lt; &quot;Writing file...&quot; &lt;&lt; std::endl &lt;&lt; std::endl;<br>
&nbsp;<br>&nbsp;writer-&gt;Update();<br>&nbsp;<br>&nbsp;std::cout &lt;&lt; &quot;File &#39;&quot; &lt;&lt; argv[nbImages+1] &lt;&lt; &quot;&#39; created&quot; &lt;&lt; std::endl;<br><br>&nbsp;return EXIT_SUCCESS;<br>&nbsp;<br>&nbsp;}<br><br><br><br><br><br>
<br><br>Bye,<br><br><br><br>Stéphane<br></div>