[Insight-users] Weighted adding of images

Dan Mueller dan.muel at gmail.com
Wed Nov 19 02:52:47 EST 2008


Hi Fran,

You may also be interested in the following filters:
    http://www.itk.org/Doxygen/html/classitk_1_1NaryAddImageFilter.html
    http://www.itk.org/Doxygen/html/classitk_1_1WeightedAddImageFilter.html

I would recommend creating your own filter which combines both of
these. It should be fairly easy to create a functor similar to the
n-ary add one (which accepts multiple inputs), but which also also
allows you to set weights. (BTW: it took me a while to work out what
n-ary means, to help think: binary, ternary, n-ary.)

Hope this helps.

Regards, Dan

2008/11/18 Fran Serrano <sercha at gmail.com>:
> Dear Insight users,
>
> I want to add 5 images weighted by its respective coefficient:
>
> out = a * in1 + b * in2 + c * in3 + d * in4 + e * in5
>
> Due to there is no one ITK function, there are multiple options for
> implementations of the filter:
>
> -Using the class  itk::MultiplyByConstantImageFilter< TInputImage,
> TConstant, TOutputImage > for each image and then use  the class
>  itk::TernaryAddImageFilter< TInputImage1, TInputImage2, TInputImage3,
> TOutputImage > twice to sum the 5 images.
>
> -My second option is implementing an iterator which open the images, add the
> weighted values.
>
> Which option do you recomend? There is any other fast option for doing that?
>
> Thanks,
>
> Fran Serrano
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>


More information about the Insight-users mailing list