[Insight-users] Bug with fix Mean Image Filter

Bradley Lowekamp blowekamp at mail.nih.gov
Wed May 18 12:33:26 EDT 2005


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


More information about the Insight-users mailing list