# DiscreteGaussianImageFilter with RGBPixel

**URL:** <https://discourse.itk.org/t/discretegaussianimagefilter-with-rgbpixel/5231>\
**Category:** Algorithms\
**Created:** [July 31, 2022, 9:17pm UTC](https://discourse.itk.org/t/discretegaussianimagefilter-with-rgbpixel/5231 "2022-07-31T21:17:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthieu\_Brucher](https://discourse.itk.org/user_avatar/discourse.itk.org/matthieu_brucher/32/2874_2.png) [@Matthieu\_Brucher](https://discourse.itk.org/u/Matthieu_Brucher)\
**Post date:** [July 31, 2022, 9:17pm UTC](https://discourse.itk.org/t/discretegaussianimagefilter-with-rgbpixel/5231/1 "2022-07-31T21:17:54Z")

</div>

Is it possible to natively get an image with RGBPixel\<\> as the internal type filtered with this filter?  
Looks like there are some issues with ITK 5.2.0, as the intermediate type messes up the setup and stops with:

/opt/homebrew/include/ITK-5.2/itkNeighborhoodInnerProduct.hxx:48:85: Invalid operands to binary expression (‘OutputPixelValueType’ (aka ‘double’) and ‘InputPixelRealType’ (aka ‘RGBPixel’))

(not sure how I ended up with doubles when I started with RGBPixel!)

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [August 1, 2022, 12:36pm UTC](https://discourse.itk.org/t/discretegaussianimagefilter-with-rgbpixel/5231/2 "2022-08-01T12:36:11Z")

</div>

It looks like `DiscreteGaussianImageFilter` assumes scalar pixel type. You might need to do it one component at a time, using for example [VectorImageToImageAdaptor](https://itk.org/Doxygen/html/classitk_1_1VectorImageToImageAdaptor.html) and [ComposeImageFilter](https://examples.itk.org/src/filtering/imagecompose/composevectorfromthreescalarimages/documentation).

---

<div class="post-metadata">

**Author:** ![Matthieu\_Brucher](https://discourse.itk.org/user_avatar/discourse.itk.org/matthieu_brucher/32/2874_2.png) [@Matthieu\_Brucher](https://discourse.itk.org/u/Matthieu_Brucher)\
**Post date:** [August 1, 2022, 6:06pm UTC](https://discourse.itk.org/t/discretegaussianimagefilter-with-rgbpixel/5231/3 "2022-08-01T18:06:08Z")

</div>

Indeed, it’s what I will be doing, but it looks like a waste of resources to copy the data instead of just smoothing everything in place ☹

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [August 1, 2022, 6:31pm UTC](https://discourse.itk.org/t/discretegaussianimagefilter-with-rgbpixel/5231/4 "2022-08-01T18:31:41Z")

</div>

If you feel like it, you could upgrade `DiscreteGaussianImageFilter` with support for multi-component pixel types!

---

<div class="post-metadata">

**Author:** ![Matthieu\_Brucher](https://discourse.itk.org/user_avatar/discourse.itk.org/matthieu_brucher/32/2874_2.png) [@Matthieu\_Brucher](https://discourse.itk.org/u/Matthieu_Brucher)\
**Post date:** [August 1, 2022, 6:35pm UTC](https://discourse.itk.org/t/discretegaussianimagefilter-with-rgbpixel/5231/5 "2022-08-01T18:35:46Z")

</div>

Yes, I could, I’m still struggling to fight against the smart pointers though, so one step after the other 😃
