[Insight-developers] NumericTraits' AccumulateType question.

Jisung Kim bahrahm at yahoo . com
Thu, 24 Jul 2003 12:01:45 -0700 (PDT)


Hi.

I just found out very interesting aspect of ITK
NumericTraits while I was testing my mean shift
blurring classes.

Inside of the mean shift mode seeking class, I
declared the temporary sum of measurement vectors in a
spherical kernel using NumericTraits< unsigned char
>::AccumulateType. The input data is an unsigned char
image of 256 x 256 pixels. The AccumulateType is
unsigned short of which max value is 65535. If the
pixel value is 255, then the sum of 257 pixels exceeds
the limit of unsigned short. 

My suggestion is that all UNSIGNED integer types have
"unsigned long" as AccumulateType and all SIGNED
integer types have "long" as AccumulateType. 

Along the same line of suggestion, should the
AccumulateType of float and double be long double?

Thanks,

Jisung.

=====
Jisung Kim
bahrahm at yahoo . com
106 Mason Farm Rd.
129 Radiology Research Lab., CB# 7515
Univ. of North Carolina at Chapel Hill
Chapel Hill, NC 27599-7515

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder . yahoo . com