[Insight-users] Bug with fix Mean Image Filter

Bradley Lowekamp blowekamp at mail.nih.gov
Tue May 17 16:58:20 EDT 2005


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 --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1108 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/insight-users/attachments/20050517/3ad1629e/attachment.bin


More information about the Insight-users mailing list