[Insight-developers] NumericTraits' AccumulateType question.

Miller, James V (Research) millerjv at crd . ge . com
Thu, 24 Jul 2003 16:04:31 -0400


Usually AccumulateType is defined as the smallest type that can hold
the sum of two variables of a particular type.

You can always use RealType for the accumulation of many variables.

> -----Original Message-----
> From: Jisung Kim [mailto:bahrahm at yahoo . com]
> Sent: Thursday, July 24, 2003 3:02 PM
> To: insight-dev-list
> Subject: [Insight-developers] NumericTraits' AccumulateType question.
> 
> 
> 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
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk . org
> http://www . itk . org/mailman/listinfo/insight-developers
>