[Insight-users] Bug with fix Mean Image Filter
Miller, James V (Research)
millerjv at crd.ge.com
Wed May 18 17:02:54 EDT 2005
FixedArray is the superclass of Vector. Vectors (and Points and Covariant vector) add semantics to a FixedArray. For instance, a Vector is used to represent a direction. A Point is used to represent a position. A FixedArray is just a collection of values with not semantics.
-----Original Message-----
From: Bradley Lowekamp [mailto:blowekamp at mail.nih.gov]
Sent: Wednesday, May 18, 2005 12:33 PM
To: Miller, James V (Research)
Cc: insight-users at itk.org
Subject: Re: [Insight-users] Bug with fix Mean Image Filter
it.Set( static_vast<OutputPixelType>(sum * ( 1.0 / double(neighbothoodSize))) );
That should work too. But I think that it is an oversite that NumericTraits<RGBPixel> does not have ScalarRealType.
With regards to the added operator to RGBPixel (and likely for RGBAPixel too), I am still confused about the differences between FixedArray and Vector classes. I think I read in the Software Guide instances where each were used, though I can't seemed to find an example of FixedArray at the moment. The Vector class provides many math operators so I also don't understand why they specific pixel types were not derived from the Vector class.
Thanks.
========================================================
Bradley Lowekamp
Management Systems Designers Contractor for
Office of High Performance Computing and Communications
National Library of Medicine
'blowekamp at mail.nih.gov
On May 18, 2005, at 9:22 AM, Miller, James V ((Research)) wrote:
Can you use:
A better option is probably to add scalar division (by a floating point type) to the RGBPixel type.
Jim
-----Original Message-----
From: insight-users-bounces+millerjv=crd.ge.com at itk.org [mailto:insight-users-bounces+millerjv=crd.ge.com at itk.org]On Behalf Of Bradley Lowekamp
Sent: Tuesday, May 17, 2005 4:58 PM
To: insight-users at itk.org
Subject: [Insight-users] Bug with fix Mean Image Filter
I was trying to use mean Image Filter with RGBPixel Type. This failed because this pixel type did not supported the needed operator. This was the line
// get the mean value
it.Set( static_vast<OutputPixelType>(sum / double(neighbothoodSize)) );
RGBPixels do not support the divide by scalars operator. Perhaps because this type may have only been designed to used with unsigned chars? Any way the fix I coded up was:
// get the mean value
it.Set( static_vast<OutputPixelType>(sum * (1.0/NumericTraits<OutputPixelType>::ScalarRealType(neighbothoodSize))) );
However, that didn't work because NumericTraits<RGBPixel<unsigned char>> does not have a ScalarRealType member, like every other numeric traits. I actually am using RGBPixelType<double> but I implemented the numeric traits my self.
Thanks.
========================================================
Bradley Lowekamp
Management Systems Designers Contractor for
Office of High Performance Computing and Communications
National Library of Medicine
'blowekamp at mail.nih.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20050518/636b9d13/attachment.html
More information about the Insight-users
mailing list