[Insight-developers] NumericTraits for RGBPixel
Gaëtan Lehmann
gaetan.lehmann at jouy.inra.fr
Thu Jan 15 13:11:27 EST 2009
- sorry, I forgot to send that mail yesterday
Le 14 janv. 09 à 16:51, Bradley Lowekamp a écrit :
> Hello,
>
> ITK does not have max defined for any of the vector or array like
> classes either. I am pretty sure that this was done on purpose.
>
> From a theoretical point of view, a maximum is defined as the
> greatest element in a set. This essentially implies that the set can
> be ordered and have comparative operators. I don't think this is
> true for vector-like elements.
>
I think you're right, and that's the reason why there is no max()
function. However, nothing force us to define the max() method as the
method which returns the largest possible RGBPixel value (that would
imply to have a comparative operator for RGBPixel). We can rather
define it as the function which returns the RGBPixel with the greatest
value for the 3 components.
> Does the connected components algorithm need the max trait?
No, it's for BinaryThresholdImageFilter, which is used in the test.
max() is used to set the default foreground value of the binary output.
>
>
> Brad
>
> On Jan 14, 2009, at 9:18 AM, Gaëtan Lehmann wrote:
>
>>
>> Hi,
>>
>> I'm fixing the bug uncovered by Julien Michel in
>> ConnectedComponentImageFilter with RGB images as input, and want to
>> add a test for it.
>> However, I can't succeed to build the modified test because
>> itk::NumericTraits< RGBPixelType< unsigned char > >::max() is not
>> defined.
>> Is it done on purpose?
>>
>> Also, some functions defined in those numeric traits look
>> suspicious to me, like
>>
>> typedef _TYPENAME_ NumericTraits<T>::RealType
>> ElementRealType; \
>> typedef RGBPixel<ElementRealType> RealType; \
>> static const RealType max( const Self & a ) \
>> { \
>> RealType b(a.Size()); \
>> b.Fill( NumericTraits< T >::max() ); \
>> return b; \
>> } \
>>
>> Why should max( const Self & a ) return a RealType? Why b inside
>> the function is filled with the size of a (which is always 3), and
>> then filled with zeros?
>> For the scalar types, that function simply return the value of max().
>>
>> Regards,
>>
>> Gaëtan
>>
>>
>> --
>> Gaëtan Lehmann
>> Biologie du Développement et de la Reproduction
>> INRA de Jouy-en-Josas (France)
>> tel: +33 1 34 65 29 66 fax: 01 34 65 29 09
>> http://voxel.jouy.inra.fr http://www.mandriva.org
>> http://www.itk.org http://www.clavier-dvorak.org
>>
>> _______________________________________________
>> Insight-developers mailing list
>> Insight-developers at itk.org
>> http://www.itk.org/mailman/listinfo/insight-developers
>
> ========================================================
> Bradley Lowekamp
> Lockheed Martin Contractor for
> Office of High Performance Computing and Communications
> National Library of Medicine
> blowekamp at mail.nih.gov
>
>
--
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66 fax: 01 34 65 29 09
http://voxel.jouy.inra.fr http://www.mandriva.org
http://www.itk.org http://www.clavier-dvorak.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090115/a545dc82/attachment.pgp>
More information about the Insight-developers
mailing list