Thank you for the explanation of "Nary" ;-)<br>
<br>
I'm not an expert... but to change something in the code I need "itkNaryAddImageFilter<b>.cxx</b>" and not "itkNaryAddImageFilter<b>.h</b>" ?<br><br>Do I talk nonsense?<br><br><br><br>Thank you,<br>
<br>Stéphane<br><br><br><br> <br><div class="gmail_quote">2008/10/22 Dan Mueller <span dir="ltr"><<a href="mailto:dan.muel@gmail.com">dan.muel@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Stéphane,<br>
<div class="Ih2E3d"><br>
> - Why do you tell me about "NaryAddImageFilter" ? I was using<br>
> AddImageFilter.<br>
</div>I mentioned NaryAddImageFilter in my first response to your question<br>
(which I see now I forgot to send to the mailing list).<br>
<br>
> What's the difference ?<br>
AddImageFilter takes 2 inputs, NaryAddImageFilter takes N inputs (ie.<br>
unary, binary, "n"-ary).<br>
<div class="Ih2E3d"><br>
> - I have no "NaryAddImageFilter.cxx" or "AddImageFilter.cxx" in my ITK<br>
> repertory. I didn't find it on the Internet either. Where can I find it if I<br>
> want to transform "Add" to "Mean" ?<br>
</div>You will find it in Code\BasicFilters\itkNaryAddImageFilter.h.<br>
<div><div></div><div class="Wj3C7c"><br>
Hope this helps.<br>
<br>
Regards, Dan<br>
<br>
2008/10/22 Stéphane CALANDE <<a href="mailto:scalande@gmail.com">scalande@gmail.com</a>>:<br>
> Thank you Dan ;-)<br>
><br>
> I have 2 questions :<br>
><br>
> - Why do you tell me about "NaryAddImageFilter" ? I was using<br>
> AddImageFilter. What's the difference ?<br>
><br>
> - I have no "NaryAddImageFilter.cxx" or "AddImageFilter.cxx" in my ITK<br>
> repertory. I didn't find it on the Internet either. Where can I find it if I<br>
> want to transform "Add" to "Mean" ?<br>
><br>
><br>
><br>
> Have a nice day,<br>
><br>
><br>
><br>
> Stéphane<br>
><br>
><br>
><br>
> 2008/10/22 Dan Mueller <<a href="mailto:dan.muel@gmail.com">dan.muel@gmail.com</a>><br>
>><br>
>> Hi Stéphane,<br>
>><br>
>> Yes, good point: the MeanImageFilter will not work for multiple<br>
>> images. Sorry for the confusion, I did not think carefully enough<br>
>> before sending the email.<br>
>><br>
>> You will either have to make your own NaryMeanImageFilter (similar to<br>
>> NaryAddImageFilter) or use the NaryAddImageFilter and the<br>
>> DivideImageFilter together.<br>
>><br>
>> Regards, Dan<br>
>><br>
>> 2008/10/22 Stéphane CALANDE <<a href="mailto:scalande@gmail.com">scalande@gmail.com</a>>:<br>
>> > Thank you very much for your help Dan,<br>
>> ><br>
>> ><br>
>> > I tried "MeanImageFilter" but I'm not sure I can calculate the mean of<br>
>> > several images.<br>
>> > In fact, the functions SetInput1, SetInput2,... don't exist for<br>
>> > MeanImageFilter...<br>
>> ><br>
>> > Do you have some advice ?<br>
>> ><br>
>> ><br>
>> > Meanwhile, I'm going to try the DivideImageFilter.<br>
>> ><br>
>> ><br>
>> ><br>
>> > Thank you in advance,<br>
>> ><br>
>> ><br>
>> ><br>
>> > Stéphane<br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> > 2008/10/22 Dan Mueller <<a href="mailto:dan.muel@gmail.com">dan.muel@gmail.com</a>><br>
>> >><br>
>> >> Hi Stéphane,<br>
>> >><br>
>> >> You probably want the MeanImageFilter:<br>
>> >> <a href="http://www.itk.org/Doxygen/html/classitk_1_1MeanImageFilter.html" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1MeanImageFilter.html</a><br>
>> >><br>
>> >> You can use it in the same way as the add image filter that Luis<br>
>> >> described in his reply to your original question.<br>
>> >><br>
>> >> reader->SetFileName( name[0] );<br>
>> >> reader->Update();<br>
>> >> ImageType::Pointer inputImage1 = reader->GetOutput();<br>
>> >> mean->SetInput1( inputImage1 );<br>
>> >><br>
>> >> for( int i=1; i<numberOfFiles; i++)<br>
>> >> {<br>
>> >> reader->SetFileName( name[i] );<br>
>> >> reader->Update();<br>
>> >> ImageType::Pointer inputImage2 = reader->GetOutput();<br>
>> >> inputImage2->DisconnectPipeline();<br>
>> >> mean>SetInput2( inputImage2 );<br>
>> >> mean->Update();<br>
>> >> ImageType::Pointer sumImage = adder->GetOutput();<br>
>> >> meanImage->DisconnectPipeline();<br>
>> >> mean->SetInput1( meanImage );<br>
>> >> }<br>
>> >><br>
>> >> // Here meanImage has the output.<br>
>> >><br>
>> >> Alternatively, you could use the DivideImageFilter after you have<br>
>> >> computed the sum:<br>
>> >> <a href="http://www.itk.org/Doxygen/html/classitk_1_1DivideImageFilter.html" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1DivideImageFilter.html</a><br>
>> >><br>
>> >> Hope this helps.<br>
>> >><br>
>> >> Regards, Dan<br>
>> >><br>
>> >> 2008/10/22 Stéphane CALANDE <<a href="mailto:scalande@gmail.com">scalande@gmail.com</a>>:<br>
>> >> > Finally, I think that "itkAddImageFilter" is not what I need.<br>
>> >> ><br>
>> >> > Which function can I use to create a program that takes multiple 3D<br>
>> >> > images.mhd as input and create as output one 3D image.mhd containing<br>
>> >> > the<br>
>> >> > average(mean) of the multiple images ?<br>
>> >> ><br>
>> >> > Any help is appreciated...<br>
>> >> ><br>
>> >> ><br>
>> >> > Thank you !<br>
>> >> ><br>
>> >> ><br>
>> >> ><br>
>> >> > Stéphane<br>
>> >> ><br>
>> >> ><br>
>> >> ><br>
>> >> ><br>
>> >> > 2008/10/22 Stéphane CALANDE <<a href="mailto:scalande@gmail.com">scalande@gmail.com</a>><br>
>> >> >><br>
>> >> >> Hi Luis, hi everybody...<br>
>> >> >><br>
>> >> >><br>
>> >> >> I have little problems with the program I created to add my images<br>
>> >> >> (see<br>
>> >> >> former mail) : in fact I badly expressed myself.<br>
>> >> >> I don't want a program that "sums" my 3D metaheaders images, but I<br>
>> >> >> want<br>
>> >> >> a<br>
>> >> >> program that give, as output, a file containing a MEAN of the<br>
>> >> >> images.<br>
>> >> >><br>
>> >> >> If I have 10 images represented by different "grey-level", the image<br>
>> >> >> I<br>
>> >> >> want is an other "grey-level" one (but now the problem is that the<br>
>> >> >> output<br>
>> >> >> image is black and white, probably because of the SUM, isn't it?)<br>
>> >> >><br>
>> >> >><br>
>> >> >> Luis, I'd like to know if the program you gave me (just under this<br>
>> >> >> mail)<br>
>> >> >> can resolve that problem ?<br>
>> >> >><br>
>> >> >> I'm trying to compile it but the variable "adder" is undeclared...<br>
>> >> >> What<br>
>> >> >> is<br>
>> >> >> the type of "adder" ? Can you help me ?<br>
>> >> >><br>
>> >> >><br>
>> >> >> Thank you very much !!<br>
>> >> >><br>
>> >> >><br>
>> >> >><br>
>> >> >> Stéphane<br>
>> >> >><br>
>> >> >><br>
>> >> >> 2008/10/16 Luis Ibanez <<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>><br>
>> >> >>><br>
>> >> >>> Hi Stéphane<br>
>> >> >>><br>
>> >> >>> It should be relatively straight forward to implement this.<br>
>> >> >>><br>
>> >> >>> Put the list of filenames in an array of std::strings called<br>
>> >> >>> "name" and do the following:<br>
>> >> >>><br>
>> >> >>><br>
>> >> >>> reader->SetFileName( name[0] );<br>
>> >> >>> reader->Update();<br>
>> >> >>> ImageType::Pointer inputImage1 = reader->GetOutput();<br>
>> >> >>> adder->SetInput1( inputImage1 );<br>
>> >> >>><br>
>> >> >>> for( int i=0; i<numberOfFiles; i++)<br>
>> >> >>> {<br>
>> >> >>> reader->SetFileName( name[i] );<br>
>> >> >>> reader->Update();<br>
>> >> >>> ImageType::Pointer inputImage2 = reader->GetOutput();<br>
>> >> >>> inputImage2->DisconnectPipeline();<br>
>> >> >>> adder->SetInput2( inputImage2 );<br>
>> >> >>> adder->Update();<br>
>> >> >>> ImageType::Pointer sumImage = adder->GetOutput();<br>
>> >> >>> sumImage->DisconnectPipeline();<br>
>> >> >>> adder->SetInput1( sumImage );<br>
>> >> >>> }<br>
>> >> >>><br>
>> >> >>> // Here sumImage has the output.<br>
>> >> >>><br>
>> >> >>><br>
>> >> >>> Note the use of the DisconnectPipeline() method, that<br>
>> >> >>> makes possible to reuse the reader and the adder filter.<br>
>> >> >>><br>
>> >> >>><br>
>> >> >>><br>
>> >> >>> Regards,<br>
>> >> >>><br>
>> >> >>><br>
>> >> >>> Luis<br>
>> >> >>><br>
>> >> >>><br>
>> >> >>> -------------------------<br>
>> >> >>> Stéphane CALANDE wrote:<br>
>> >> >>>><br>
>> >> >>>> Hi,<br>
>> >> >>>><br>
>> >> >>>><br>
>> >> >>>> I'm a newbie in ITK and I'm looking for a example of program that<br>
>> >> >>>> takes,<br>
>> >> >>>> as input, several 3D metaheader image (.mhd) having the same<br>
>> >> >>>> spacing,<br>
>> >> >>>> size,... and that "sums" these images to create one<br>
>> >> >>>> "total_Image.mhd"<br>
>> >> >>>> having<br>
>> >> >>>> the same size, spacing,... than the input ones.<br>
>> >> >>>><br>
>> >> >>>><br>
>> >> >>>> Does it exist ?<br>
>> >> >>>><br>
>> >> >>>><br>
>> >> >>>> Thank you very much.<br>
>> >> >>>><br>
>> >> >>>><br>
>> >> >>>><br>
>> >> >>>><br>
>> >> >>>> Regards,<br>
>> >> >>>><br>
>> >> >>>><br>
>> >> >>>> Stéphane<br>
>> >> >>>><br>
>> >> >>>><br>
>> >> >>>><br>
>> >> >>>><br>
>> >> >>>> ------------------------------------------------------------------------<br>
>> >> >>>><br>
>> >> >>>> _______________________________________________<br>
>> >> >>>> Insight-users mailing list<br>
>> >> >>>> <a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a><br>
>> >> >>>> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
>> >> >><br>
>> >> ><br>
>> >> ><br>
>> >> > _______________________________________________<br>
>> >> > Insight-users mailing list<br>
>> >> > <a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a><br>
>> >> > <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
>> >> ><br>
>> >> ><br>
>> ><br>
>> ><br>
><br>
><br>
</div></div></blockquote></div><br>