[Insight-users] Bug with fix Mean Image Filter

Miller, James V (Research) millerjv at crd.ge.com
Wed May 18 09:22:14 EDT 2005


Can you use:
 
it.Set( static_vast<OutputPixelType>(sum * ( 1.0 / double(neighbothoodSize))) ); 
 
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/f3d2e6dd/attachment.html


More information about the Insight-users mailing list