
Hi, I would like to get the value type of the channels depending on an image view. So I can get the scoped channel type, from MyView type, like this: typedef typename boost::gil::channel_type<MyView>::type MyScopedChannel; But I can't get the primitive type used by the scoped channel. For example, if the type is scoped_channel_value<float,float_zero,float_one>, I can't get the float type. /// \ingroup ScopedChannelValue /// \brief A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept template <typename BaseChannelValue, // base channel (models ChannelValueConcept) typename MinVal, typename MaxVal> // classes with a static apply() function returning the minimum/maximum channel values struct scoped_channel_value { typedef BaseChannelValue base_channel_t; //< missing typedef //... } So this will allows to use: typedef typename boost::gil::channel_type<MyView>::type::base_channel_t ChannelBaseType; Are you agree to add this typedef ? Best regards, Fabien Castan

Hi Fabien, Notice that, even after Christian's changes, ChannelValue::base_channel_t will not always be available because ChannelValue could be a built-in type. So if you want to extract this, you will have to special-case scoped_channel_value anyway. So in this case you don't need a typedef inside. You can just define a specialization like this: Template <typename ChannelValue> Struct base_channel_value { typedef ChannelValue type; }; Template <typename ChannelValue, typename MinV, typename MaxV> Struct base_channel_value<scoped_channel_value<ChannelValue, MinV, MaxV> > { typedef ChannelValue type; }; Lubomir On 7/22/10 7:05 AM, "fabien.castan@free.fr" <fabien.castan@free.fr> wrote:
Hi,
I would like to get the value type of the channels depending on an image view. So I can get the scoped channel type, from MyView type, like this: typedef typename boost::gil::channel_type<MyView>::type MyScopedChannel;
But I can't get the primitive type used by the scoped channel.
For example, if the type is scoped_channel_value<float,float_zero,float_one>, I can't get the float type.
/// \ingroup ScopedChannelValue /// \brief A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept template <typename BaseChannelValue, // base channel (models ChannelValueConcept) typename MinVal, typename MaxVal> // classes with a static apply() function returning the minimum/maximum channel values struct scoped_channel_value { typedef BaseChannelValue base_channel_t; //< missing typedef //... }
So this will allows to use: typedef typename boost::gil::channel_type<MyView>::type::base_channel_t ChannelBaseType;
Are you agree to add this typedef ?
Best regards, Fabien Castan _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Hi there, On Thu, Jul 22, 2010 at 11:26 AM, Lubomir Bourdev <lbourdev@adobe.com> wrote:
Hi Fabien,
Notice that, even after Christian's changes, ChannelValue::base_channel_t will not always be available because ChannelValue could be a built-in type.
True. But, is that the reason why this typedef never was added to scoped_channel_value or is it that no one thought that this typedef would be useful? I always wonder which it is when I use a c++ lib.
So if you want to extract this, you will have to special-case scoped_channel_value anyway. So in this case you don't need a typedef inside. You can just define a specialization like this:
Template <typename ChannelValue> Struct base_channel_value { typedef ChannelValue type; };
Template <typename ChannelValue, typename MinV, typename MaxV> Struct base_channel_value<scoped_channel_value<ChannelValue, MinV, MaxV> > { typedef ChannelValue type; };
I really have to write that one down. I keep on forgetting this trick. Regards, Christian
participants (3)
-
Christian Henning
-
fabien.castan@free.fr
-
Lubomir Bourdev