[Insight-developers] Using ConstantPadImageFilter on vector i
mages
Miller, James V (CRD)
millerjv@crd.ge.com
Thu, 3 Jan 2002 08:24:49 -0500
PixelTraits<PixelType>::Dimension will return the number of components in a pixel. It returns 1 if
the pixel is a scalar. This is used in the JoinImageFilter to determine whether an image has scalar
or vector data (so that it knows whether operator[] will work or not).
PixelTraits<PixelType>::ValueType will return the value type of a scalar or the value type of a
component of a vector.
So it would seem that the original code in ConstantPadImageFilter could use
PixelType padValue = NumericTraits<PixelTraits<PixelType>::ValueType>::Zero;
I think the Array::operator=( const ValueType&) method will copy this "zero" to all components of an
Array if PixelType was a subclass of Array. If PixelType is a scalar, then it should do the right
thing by default.
-----Original Message-----
From: Lydia Ng [mailto:lng@insightful.com]
Sent: Wednesday, January 02, 2002 6:48 PM
To: Miller, James V (CRD); Insight-developers (E-mail)
Subject: RE: [Insight-developers] Using ConstantPadImageFilter on vector
images
Jim,
> Can we change the code so that it tries to use NumericTraits
> of the "value type" of the pixel?
>
> One option is to call an overloaded function where the scalar version
> returns NumericTraits<PixelType>::Zero and the vector version returns
> NumericTraits<PixelType::ValueType>::Zero.
Does this option mean that the filter then have to know
whether or not it is dealing with scalar or vector pixels?
The filter will also have to know how big the vector
is so that it can fill the vector with the appropriate
number of zeros.
-Lydia
> -----Original Message-----
> From: Miller, James V (CRD) [mailto:millerjv@crd.ge.com]
> Sent: Wednesday, January 02, 2002 2:03 PM
> To: Lydia Ng; Insight-developers (E-mail)
> Subject: RE: [Insight-developers] Using
> ConstantPadImageFilter on vector
> images
>
>
> Can we change the code so that it tries to use NumericTraits
> of the "value type" of the pixel?
>
> One option is to call an overloaded function where the scalar version
> returns NumericTraits<PixelType>::Zero and the vector version returns
> NumericTraits<PixelType::ValueType>::Zero.
>
>
>
>
>
> -----Original Message-----
> From: Lydia Ng [mailto:lng@insightful.com]
> Sent: Thursday, December 27, 2001 6:11 PM
> To: Insight-developers (E-mail)
> Subject: [Insight-developers] Using ConstantPadImageFilter on vector
> images
>
>
> Hi All,
>
> I would like to use ConstantPadImageFilter
> on vector images (i.e. where the image pixel is
> of type itk::Vector<someScalar,vectorDimension>).
>
> The existing implementation does not work because as
> it requires the used of NumericsTraits<PixelType>::Zero
> to initialize the padding value to "zero".
> Currently, NumericsTraits for itk::Vector's are not defined.
>
> I am not sure how to go about defining a generic
> NumericsTraits for Vector. Does one have to explicitly
> specialize NumericsTraits for every combination
> of *someScalar* and *vectorDimension*?
>
> My other option is to create a vector version
> of the filter (i.e. a VectorConstantPadImageFilter) but
> that seems to be an awful lot of code duplication.
>
> Any suggestions?
>
> Cheers,
> Lydia
>
>
>
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
>
_______________________________________________
Insight-developers mailing list
Insight-developers@public.kitware.com
http://public.kitware.com/mailman/listinfo/insight-developers