[Insight-developers] MeanImageFilter : PixelType=Vector & Partial Specialization

Luis Ibanez luis.ibanez@kitware.com
Mon, 03 Mar 2003 23:22:20 -0500


Hi Ying,

This is actually a sad story,

The algorithm of the MeanImageFilter is perfectly
capable of computing the mean in any type that
provides the operator+ and the operator*(float).

Unfortunately the limitation arrives with the use
of NumericTraits for initializing the sum of the
vectors participating in the mean.  This zero
initialization is done using NumbericTraits<>::Zero.

This is fine for simple types since the explicit
instantiations of NumbericTraits can be done with
few effort.

For vectors, however, Numberic traits would have to
be specialized for every component type and any
dimension, or at least for those that you plan to use.

The simple way of doing this is to use "Partial
Specialization"

but...

Microsoft doesn't support this behaviour in spite of
the fact of being defined in the C++ standard.

Rummor exist that the next version of VC++ could support
this fundamental feature...

In the meantime we are stock with this limitation.

....

Now that,
If you are working in Unix, you can solve this
by adding specialization to the NumbericTraits.h file.
Once you have the specialization, you can simply
instantiate the itk::MeanImageFilter over an image
of pixel type = vector.

.....


Please let us know if you have further questions,


   Thanks


     Luis


-----------------------

Ying Zhuge wrote:
> Hi,
> 
> Is there a simply way to do mean filtering for a vector image? It seems 
> that the MeanImageFilter works only for scalar image, right?
> 
> -Ying
> 
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
>