$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mln::trait::ch_value< I, V > Struct Template Reference

#include <mln/trait/ch_value.hh>

Public Types

typedef impl::ch_value_
< skeleton, V >::ret 
ret
typedef I::skeleton skeleton

Related Functions

(Note that these are not member functions.)

#define mln_ch_value(I, V)   typename mln::trait::ch_value< I, V >::ret
#define mln_ch_value_(I, V)   mln::trait::ch_value< I, V >::ret

Detailed Description

template<typename I, typename V>
struct mln::trait::ch_value< I, V >

Compute the concrete type of an image type and change the value type.

Template Parameters
IAn image type.

This macro is used to compute the most appropriate concrete image type to be used to store a copy of an image of type I.

A concrete image type is an image type storing all its site values in a single memory buffer. For instance, mln::image1d, mln::image2d, mln::image3d are considered as concrete types. Image morphers are not concrete types since they can alter, on the fly, the domain and the values.

This macro is usually used while writing generic algorithms to handle all possible cases while image morphers and concrete images are interacting.

Compared to mln::trait::concrete, this trait can change the value type of the computed image type.

Few examples:

Therefore, you can safely write the following code:

template<typename I>
mln_ch_value(I,bool) my_function(const Image<I>& ima)
{
mln_ch_value(I,bool) output;
...
return output;
}
int main()
{
image2d<int> ima;
image2d<bool> result = my_function(ima);
}

Computing a type with trait::concrete can be done using macros mln_ch_value() and mln_ch_value_().

Note that, due to C++ syntax ambiguities, mln_ch_value() should be used in a templated function whereas mln_ch_value_() shoud be used in a non-templated function.

If you are not sure of the concrete type that should be returned by the macro, take a look at mln_var() which can guess it for you.

Definition at line 285 of file ch_value.hh.

Friends And Related Function Documentation

template<typename I, typename V>
#define mln_ch_value (   I,
 
)    typename mln::trait::ch_value< I, V >::ret
related

Macros provided for convenience. Should be used in a templated function only.

Definition at line 43 of file ch_value.hh.

template<typename I, typename V>
#define mln_ch_value_ (   I,
 
)    mln::trait::ch_value< I, V >::ret
related

Macros provided for convenience. Should be used in a non-templated function only.

Definition at line 49 of file ch_value.hh.

Member Typedef Documentation

template<typename I, typename V>
typedef impl::ch_value_<skeleton, V>::ret mln::trait::ch_value< I, V >::ret

Definition at line 288 of file ch_value.hh.

template<typename I, typename V>
typedef I::skeleton mln::trait::ch_value< I, V >::skeleton

Definition at line 287 of file ch_value.hh.